nixos/shells: enable to nullify already defined aliases
This commit is contained in:
parent
3b5449b80c
commit
c941577dcb
@ -108,13 +108,14 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
environment.shellAliases = mkOption {
|
environment.shellAliases = mkOption {
|
||||||
example = { ll = "ls -l"; };
|
example = { l = null; ll = "ls -l"; };
|
||||||
description = ''
|
description = ''
|
||||||
An attribute set that maps aliases (the top level attribute names in
|
An attribute set that maps aliases (the top level attribute names in
|
||||||
this option) to command strings or directly to build outputs. The
|
this option) to command strings or directly to build outputs. The
|
||||||
aliases are added to all users' shells.
|
aliases are added to all users' shells.
|
||||||
|
Aliases mapped to <code>null</code> are ignored.
|
||||||
'';
|
'';
|
||||||
type = with types; attrsOf (either str path);
|
type = with types; attrsOf (nullOr (either str path));
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.binsh = mkOption {
|
environment.binsh = mkOption {
|
||||||
|
@ -33,7 +33,8 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
bashAliases = concatStringsSep "\n" (
|
bashAliases = concatStringsSep "\n" (
|
||||||
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
|
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
|
||||||
|
(filterAttrs (k: v: !isNull v) cfg.shellAliases)
|
||||||
);
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -64,7 +65,7 @@ in
|
|||||||
Set of aliases for bash shell, which overrides <option>environment.shellAliases</option>.
|
Set of aliases for bash shell, which overrides <option>environment.shellAliases</option>.
|
||||||
See <option>environment.shellAliases</option> for an option format description.
|
See <option>environment.shellAliases</option> for an option format description.
|
||||||
'';
|
'';
|
||||||
type = with types; attrsOf (either str path);
|
type = with types; attrsOf (nullOr (either str path));
|
||||||
};
|
};
|
||||||
|
|
||||||
shellInit = mkOption {
|
shellInit = mkOption {
|
||||||
|
@ -9,7 +9,8 @@ let
|
|||||||
cfg = config.programs.fish;
|
cfg = config.programs.fish;
|
||||||
|
|
||||||
fishAliases = concatStringsSep "\n" (
|
fishAliases = concatStringsSep "\n" (
|
||||||
mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}") cfg.shellAliases
|
mapAttrsFlatten (k: v: "alias ${k} ${escapeShellArg v}")
|
||||||
|
(filterAttrs (k: v: !isNull v) cfg.shellAliases)
|
||||||
);
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -58,7 +59,7 @@ in
|
|||||||
Set of aliases for fish shell, which overrides <option>environment.shellAliases</option>.
|
Set of aliases for fish shell, which overrides <option>environment.shellAliases</option>.
|
||||||
See <option>environment.shellAliases</option> for an option format description.
|
See <option>environment.shellAliases</option> for an option format description.
|
||||||
'';
|
'';
|
||||||
type = with types; attrsOf (either str path);
|
type = with types; attrsOf (nullOr (either str path));
|
||||||
};
|
};
|
||||||
|
|
||||||
shellInit = mkOption {
|
shellInit = mkOption {
|
||||||
|
@ -11,7 +11,8 @@ let
|
|||||||
cfg = config.programs.zsh;
|
cfg = config.programs.zsh;
|
||||||
|
|
||||||
zshAliases = concatStringsSep "\n" (
|
zshAliases = concatStringsSep "\n" (
|
||||||
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
|
mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
|
||||||
|
(filterAttrs (k: v: !isNull v) cfg.shellAliases)
|
||||||
);
|
);
|
||||||
|
|
||||||
in
|
in
|
||||||
@ -39,7 +40,7 @@ in
|
|||||||
Set of aliases for zsh shell, which overrides <option>environment.shellAliases</option>.
|
Set of aliases for zsh shell, which overrides <option>environment.shellAliases</option>.
|
||||||
See <option>environment.shellAliases</option> for an option format description.
|
See <option>environment.shellAliases</option> for an option format description.
|
||||||
'';
|
'';
|
||||||
type = with types; attrsOf (either str path);
|
type = with types; attrsOf (nullOr (either str path));
|
||||||
};
|
};
|
||||||
|
|
||||||
shellInit = mkOption {
|
shellInit = mkOption {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user