Compare commits
3 Commits
de5b56d1b1
...
cc7923c1da
| Author | SHA1 | Date | |
|---|---|---|---|
| cc7923c1da | |||
| da60eaa936 | |||
| c551e8f86e |
16
modules/home/bash.nix
Normal file
16
modules/home/bash.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let cfg = config.sydnix.bash;
|
||||
in {
|
||||
options.sydnix.bash = {
|
||||
enable = lib.mkEnableOption "Bash";
|
||||
};
|
||||
|
||||
imports = [
|
||||
./bash/complete-alias.nix
|
||||
];
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bash.enable = true;
|
||||
};
|
||||
}
|
||||
16
modules/home/bash/complete-alias.nix
Normal file
16
modules/home/bash/complete-alias.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.bash.complete-alias;
|
||||
in {
|
||||
options.sydnix.bash.complete-alias = {
|
||||
enable = lib.mkEnableOption "Alias completion";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bash.initExtra = lib.mkAfter ''
|
||||
. ${lib.getExe pkgs.complete-alias}
|
||||
complete -F _complete_alias "''${!BASH_ALIASES[@]}"
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.crumb.bash;
|
||||
in {
|
||||
options.sydnix.users.crumb.bash.enable = lib.mkEnableOption "Bash, à la crumb";
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
shellOptions = [
|
||||
# Correct minor typos in cd commands.
|
||||
"cdspell"
|
||||
"autocd"
|
||||
# Extra glob power.
|
||||
"extglob"
|
||||
# Recursive glob w/ **.
|
||||
"globstar"
|
||||
# Append to history file.
|
||||
"histappend"
|
||||
# Require user confirmation for commands using expansion.
|
||||
"histverify"
|
||||
# Re-edit failed history substitutions.
|
||||
"histreedit"
|
||||
];
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
nix2json = "nix eval --impure --json --file -";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
36
modules/home/users/msyds/bash.nix
Normal file
36
modules/home/users/msyds/bash.nix
Normal file
@@ -0,0 +1,36 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.sydnix.users.msyds.bash;
|
||||
in {
|
||||
options.sydnix.users.msyds.bash.enable =
|
||||
lib.mkEnableOption "Bash, à la msyds";
|
||||
config = lib.mkIf cfg.enable {
|
||||
sydnix.bash.enable = true;
|
||||
sydnix.bash.complete-alias.enable = true;
|
||||
|
||||
programs.bash.shellOptions = [
|
||||
# Correct minor typos in cd commands.
|
||||
"cdspell"
|
||||
# Implicitly prepend `cd` to directory names.
|
||||
"autocd"
|
||||
# Extra glob power.
|
||||
"extglob"
|
||||
# Recursive glob w/ **.
|
||||
"globstar"
|
||||
# Append to history file.
|
||||
"histappend"
|
||||
# Require user confirmation for commands using expansion.
|
||||
"histverify"
|
||||
# Re-edit failed history substitutions.
|
||||
"histreedit"
|
||||
];
|
||||
|
||||
home.shellAliases = {
|
||||
nix2json = "nix eval --impure --json --file -";
|
||||
"..." = "cd ../..";
|
||||
"...." = "cd ../../..";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,6 +31,17 @@ in {
|
||||
treesit.enable = true;
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
ESHELL_ALIASES_FILE = pkgs.writeText "eshell-aliases" ''
|
||||
alias cdp syd-project-cd
|
||||
alias js js --no-pager
|
||||
${lib.concatMapAttrsStringSep
|
||||
"\n"
|
||||
(alias: value: "alias ${alias} ${value} $*")
|
||||
config.home.shellAliases}
|
||||
'';
|
||||
};
|
||||
|
||||
sydnix.emacs = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
|
||||
@@ -150,7 +150,9 @@ if FILE-NAME has no TRAMP prefix."
|
||||
(eshell-last-dir-ring-file-name (file-name-concat
|
||||
syd-eshell-data-dir "lastdir"))
|
||||
(eshell-prompt-function #'syd-eshell--prompt-fn)
|
||||
(eshell-prompt-regexp syd-eshell--prompt-regexp))
|
||||
(eshell-prompt-regexp syd-eshell--prompt-regexp)
|
||||
(eshell-aliases-file (or (getenv "ESHELL_ALIASES_FILE")
|
||||
eshell-aliases-file)))
|
||||
:general
|
||||
(:keymaps 'syd-leader-open-map
|
||||
"e" #'syd-toggle-eshell)
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
};
|
||||
# Personal configurations.
|
||||
users.crumb = {
|
||||
bash.enable = true;
|
||||
direnv.enable = true;
|
||||
git.enable = true;
|
||||
nvim.enable = true;
|
||||
@@ -68,6 +67,7 @@
|
||||
};
|
||||
users.msyds = {
|
||||
discord.enable = true;
|
||||
bash.enable = true;
|
||||
hunspell.enable = true;
|
||||
emacs.enable = true;
|
||||
impermanence.enable = true;
|
||||
|
||||
Reference in New Issue
Block a user