refractor shell configurations with flake-parts

This commit is contained in:
Danilo Reyes 2025-10-12 13:51:45 -06:00
parent 6f97b24115
commit 11fd8e0440
5 changed files with 34 additions and 44 deletions

View File

@ -1,5 +1,6 @@
{ {
config, config,
inputs,
lib, lib,
pkgs, pkgs,
... ...
@ -14,7 +15,7 @@
"doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org; "doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org;
}; };
services.lorri.enable = true; services.lorri.enable = true;
programs.${config.my.shell.type}.shellAliases = { programs.${config.my.shell.type}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
edit = "emacsclient -t"; edit = "emacsclient -t";
e = "edit"; e = "edit";
}; };

View File

@ -1,5 +1,6 @@
{ {
config, config,
inputs,
lib, lib,
pkgs, pkgs,
... ...
@ -33,7 +34,7 @@ in
}; };
config = lib.mkIf config.my.dev.nix.enable { config = lib.mkIf config.my.dev.nix.enable {
users.users.jawz = { inherit packages; }; users.users.jawz = { inherit packages; };
home-manager.users.jawz.programs.${shellType}.shellAliases = { home-manager.users.jawz.programs.${shellType}.shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
nixformat = '' nixformat = ''
deadnix -e && \ deadnix -e && \
nix run nixpkgs#nixfmt-tree && \ nix run nixpkgs#nixfmt-tree && \

View File

@ -17,32 +17,23 @@
in in
{ {
home-manager.users.jawz.programs.${config.my.shell.type} = { home-manager.users.jawz.programs.${config.my.shell.type} = {
shellAliases = { shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
dl = "${download}/bin/download -u jawz -i"; dl = "${download}/bin/download -u jawz -i";
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"''; comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"''; gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
}; };
} }
// ( // inputs.self.lib.shellConditional config.my.shell.type ''
if config.my.shell.type == "bash" then list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
{ export LW=$list_root/watch.txt
initExtra = '' export LI=$list_root/instant.txt
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz export LC=$list_root/comic.txt
export LW=$list_root/watch.txt '' ''
export LI=$list_root/instant.txt list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LC=$list_root/comic.txt export LW=$list_root/watch.txt
''; export LI=$list_root/instant.txt
} export LC=$list_root/comic.txt
else '';
{
initContent = ''
list_root=$XDG_CONFIG_HOME/jawz/lists/jawz
export LW=$list_root/watch.txt
export LI=$list_root/instant.txt
export LC=$list_root/comic.txt
'';
}
);
systemd.user = { systemd.user = {
services = services =
let let

View File

@ -57,7 +57,7 @@ in
}; };
}; };
${shellType} = { ${shellType} = {
shellAliases = { shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
cd = "z"; cd = "z";
hh = "hstr"; hh = "hstr";
ls = "eza --icons --group-directories-first"; ls = "eza --icons --group-directories-first";
@ -70,26 +70,17 @@ in
uniq --count | sort -rn''; uniq --count | sort -rn'';
}; };
} }
// ( // inputs.self.lib.shellConditional shellType ''
if shellType == "bash" then if command -v fzf-share >/dev/null; then
{ source "$(fzf-share)/key-bindings.bash"
initExtra = '' source "$(fzf-share)/completion.bash"
if command -v fzf-share >/dev/null; then fi
source "$(fzf-share)/key-bindings.bash" '' ''
source "$(fzf-share)/completion.bash" if command -v fzf-share >/dev/null; then
fi source "$(fzf-share)/key-bindings.bash"
''; source "$(fzf-share)/completion.bash"
} fi
else '';
{
initContent = ''
if command -v fzf-share >/dev/null; then
source "$(fzf-share)/key-bindings.bash"
source "$(fzf-share)/completion.bash"
fi
'';
}
);
}; };
programs = { programs = {
starship.enable = true; starship.enable = true;

View File

@ -192,6 +192,12 @@ in
|> builtins.filter ( |> builtins.filter (
name: !(lib.hasPrefix "wg-" name) && name != "vps" && name != "router" && name != hostName name: !(lib.hasPrefix "wg-" name) && name != "vps" && name != "router" && name != hostName
); );
shellConditional = shellType: bashContent: zshContent:
if shellType == "bash" then
{ initExtra = bashContent; }
else
{ initContent = zshContent; };
mergeAliases = baseAliases: extraAliases: baseAliases // extraAliases;
}; };
}; };
} }