mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
home: shell agnostic aliases (#2347)
This commit is contained in:
parent
70c5b268e1
commit
f6f013f764
1 changed files with 24 additions and 0 deletions
|
@ -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;
|
||||
|
@ -483,6 +503,10 @@ in
|
|||
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
|
||||
maybeSet = n: v: optionalAttrs (v != null) { ${n} = v; };
|
||||
|
|
Loading…
Reference in a new issue