bash: Make HISTFILESIZE and HISTSIZE nullable (#6443)
This commit is contained in:
parent
a70d788923
commit
22b418c13f
1 changed files with 14 additions and 12 deletions
|
|
@ -51,7 +51,7 @@ in {
|
|||
};
|
||||
|
||||
historySize = mkOption {
|
||||
type = types.int;
|
||||
type = types.nullOr types.int;
|
||||
default = 10000;
|
||||
description = "Number of history lines to keep in memory.";
|
||||
};
|
||||
|
|
@ -63,7 +63,7 @@ in {
|
|||
};
|
||||
|
||||
historyFileSize = mkOption {
|
||||
type = types.int;
|
||||
type = types.nullOr types.int;
|
||||
default = 100000;
|
||||
description = "Number of history lines to keep on file.";
|
||||
};
|
||||
|
|
@ -181,16 +181,18 @@ in {
|
|||
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
|
||||
|
||||
historyControlStr = (concatStringsSep "\n"
|
||||
(mapAttrsToList (n: v: "${n}=${v}") ({
|
||||
HISTFILESIZE = toString cfg.historyFileSize;
|
||||
HISTSIZE = toString cfg.historySize;
|
||||
} // optionalAttrs (cfg.historyFile != null) {
|
||||
HISTFILE = ''"${cfg.historyFile}"'';
|
||||
} // optionalAttrs (cfg.historyControl != [ ]) {
|
||||
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
|
||||
} // optionalAttrs (cfg.historyIgnore != [ ]) {
|
||||
HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore);
|
||||
}) ++ optional (cfg.historyFile != null)
|
||||
(mapAttrsToList (n: v: "${n}=${v}")
|
||||
(optionalAttrs (cfg.historyFileSize != null) {
|
||||
HISTFILESIZE = toString cfg.historyFileSize;
|
||||
} // optionalAttrs (cfg.historySize != null) {
|
||||
HISTSIZE = toString cfg.historySize;
|
||||
} // optionalAttrs (cfg.historyFile != null) {
|
||||
HISTFILE = ''"${cfg.historyFile}"'';
|
||||
} // optionalAttrs (cfg.historyControl != [ ]) {
|
||||
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
|
||||
} // optionalAttrs (cfg.historyIgnore != [ ]) {
|
||||
HISTIGNORE = escapeShellArg (concatStringsSep ":" cfg.historyIgnore);
|
||||
}) ++ optional (cfg.historyFile != null)
|
||||
''mkdir -p "$(dirname "$HISTFILE")"''));
|
||||
in mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue