Compare commits

...

3 Commits

Author SHA1 Message Date
cc7923c1da feat(emacs): eshell aliases from home.shellAliases
All checks were successful
build / build (push) Successful in 3m1s
2026-03-26 09:54:08 -06:00
da60eaa936 feat(bash): alias completions 2026-03-26 09:19:52 -06:00
c551e8f86e refactor: move crumb bash to msyds 2026-03-26 08:22:27 -06:00
7 changed files with 83 additions and 36 deletions

16
modules/home/bash.nix Normal file
View 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;
};
}

View 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[@]}"
'';
};
}

View File

@@ -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 ../../..";
};
};
}

View 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 ../../..";
};
};
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;