1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-28 09:28:32 +02:00

home: shell agnostic aliases (#2347)

This commit is contained in:
oberblastmeister 2021-11-06 12:10:15 -04:00 committed by GitHub
parent 70c5b268e1
commit f6f013f764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.
</para><para>
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
<xref linkend="opt-programs.bash.shellAliases"/> 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