From f6f013f7642437b0b613aec17f331fe5700fcb35 Mon Sep 17 00:00:00 2001 From: oberblastmeister <61095988+oberblastmeister@users.noreply.github.com> Date: Sat, 6 Nov 2021 12:10:15 -0400 Subject: [PATCH] home: shell agnostic aliases (#2347) --- modules/home-environment.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/modules/home-environment.nix b/modules/home-environment.nix index b3e904e5b..bc7be92ea 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -233,6 +233,26 @@ in ''; }; + home.shellAliases = mkOption { + type = with types; attrsOf str; + default = { }; + example = literalExample '' + { + g = "git"; + "..." = "cd ../.."; + } + ''; + description = '' + An attribute set that maps aliases (the top level attribute names + in this option) to command strings or directly to build outputs. + + This option should only be used to manage simple aliases that are + compatible across all shells. If you need to use a shell specific + feature then make sure to use a shell specific option, for example + for Bash. + ''; + }; + home.sessionVariables = mkOption { default = {}; type = types.attrs; @@ -482,6 +502,10 @@ in && config.submoduleSupport.externalPackageInstall then "/etc/profiles/per-user/${cfg.username}" else cfg.homeDirectory + "/.nix-profile"; + + programs.bash.shellAliases = cfg.shellAliases; + programs.zsh.shellAliases = cfg.shellAliases; + programs.fish.shellAliases = cfg.shellAliases; home.sessionVariables = let