mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
bash: allow unsetting shell options
This commit is contained in:
parent
039f786e60
commit
208e310e94
1 changed files with 12 additions and 3 deletions
|
@ -75,7 +75,14 @@ in
|
||||||
# Warn if closing shell with running jobs.
|
# Warn if closing shell with running jobs.
|
||||||
"checkjobs"
|
"checkjobs"
|
||||||
];
|
];
|
||||||
description = "Shell options to set.";
|
example = [
|
||||||
|
"extglob"
|
||||||
|
"-cdspell"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
Shell options to set. Prefix an option with
|
||||||
|
<quote><literal>-</literal></quote> to unset.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
sessionVariables = mkOption {
|
sessionVariables = mkOption {
|
||||||
|
@ -146,8 +153,10 @@ in
|
||||||
mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
|
mapAttrsToList (k: v: "alias ${k}=${escapeShellArg v}") cfg.shellAliases
|
||||||
);
|
);
|
||||||
|
|
||||||
shoptsStr = concatStringsSep "\n" (
|
shoptsStr = let
|
||||||
map (v: "shopt -s ${v}") cfg.shellOptions
|
switch = v: if hasPrefix "-" v then "-u" else "-s";
|
||||||
|
in concatStringsSep "\n" (
|
||||||
|
map (v: "shopt ${switch v} ${removePrefix "-" v}") cfg.shellOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
|
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
|
||||||
|
|
Loading…
Reference in a new issue