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,
inputs,
lib,
pkgs,
...
@ -14,7 +15,7 @@
"doom/templates/programming.org".source = ../../dotfiles/doom/templates/programming.org;
};
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";
e = "edit";
};

View File

@ -1,5 +1,6 @@
{
config,
inputs,
lib,
pkgs,
...
@ -33,7 +34,7 @@ in
};
config = lib.mkIf config.my.dev.nix.enable {
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 = ''
deadnix -e && \
nix run nixpkgs#nixfmt-tree && \

View File

@ -17,32 +17,23 @@
in
{
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";
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
};
}
// (
if config.my.shell.type == "bash" then
{
initExtra = ''
// inputs.self.lib.shellConditional config.my.shell.type ''
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
'' ''
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
'';
}
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 = {
services =
let

View File

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

View File

@ -192,6 +192,12 @@ in
|> builtins.filter (
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;
};
};
}