diff --git a/programs/aliases.nix b/programs/aliases.nix index 7cbf6e3..c5258ca 100644 --- a/programs/aliases.nix +++ b/programs/aliases.nix @@ -1,17 +1,26 @@ { - "vim" = "hx"; - "ls" = "exa --all --icons"; - "dig" = "doggo"; + "vim".command = "hx"; + "ls" = { + command = "exa --all --icons"; + fishAlias = true; + }; + "dig".command = "doggo"; - "glol" = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"; - "ghrvw" = "gh repo view --web"; + "glol" = { + command = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"; + fishAlias = true; + }; + "ghrvw".command = "gh repo view --web"; - "opr" = "op run --env-file=.env.1password --"; - "dr" = "doppler run --"; + "opr".command = "op run --env-file=.env.1password --"; + "dr".command = "doppler run --"; - "dequarantine" = "xattr -d com.apple.quarantine"; + "dequarantine".command = "xattr -d com.apple.quarantine"; - "bcpa" = "brew cleanup --prune=all"; - "puil" = "pnpm update --interactive --latest"; - "pip-upgrade-all" = "pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U"; + "bcpa".command = "brew cleanup --prune=all"; + "puil".command = "pnpm update --interactive --latest"; + "pip-upgrade-all" = { + command = "pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U"; + fishAlias = true; + }; } diff --git a/programs/fish.nix b/programs/fish.nix index 3b4362d..abcda88 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -1,7 +1,11 @@ -{...}: { +{lib, ...}: let + aliases = import ./aliases.nix; + shellAbbrs = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: !(b.fishAlias or false)) aliases); + shellAliases = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: builtins.hasAttr "fishAlias" b && b.fishAlias) aliases); +in { programs.fish = { enable = true; - shellAbbrs = import ./aliases.nix; + inherit shellAbbrs shellAliases; }; home.file.".config/fish/conf.d" = { diff --git a/programs/zsh.nix b/programs/zsh.nix index 2edba13..585fa25 100644 --- a/programs/zsh.nix +++ b/programs/zsh.nix @@ -1,4 +1,6 @@ -{pkgs, ...}: { +{pkgs, ...}: let + shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ./aliases.nix); +in { programs.zsh = { enable = true; enableAutosuggestions = true; @@ -11,7 +13,7 @@ initExtraBeforeCompInit = builtins.readFile ./zsh/initExtraBeforeCompInit.zsh; initExtra = builtins.readFile ./zsh/initExtra.zsh; - shellAliases = import ./aliases.nix; + inherit shellAliases; localVariables = { vivid_theme = "catppuccin-macchiato";