bash: don't unconditionally set HISTFILE variable (#1621)
The bash module always assigns a value to HISTFILE in the bashrc, even when no value is explicitly set. This makes it impossible to tell bash to use a different HISTFILE by setting the HISTFILE environment variable HISTFILE=/tmp/bash_history bash This changes the default value of programs.bash.historyFile to null, and only writes the HISTFILE=... line to the bashrc if it is changed to something else.
This commit is contained in:
parent
87e2ec341b
commit
1ee1d01daa
|
@ -30,8 +30,8 @@ in
|
|||
};
|
||||
|
||||
historyFile = mkOption {
|
||||
type = types.str;
|
||||
default = "$HOME/.bash_history";
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
description = "Location of the bash history file.";
|
||||
};
|
||||
|
||||
|
@ -157,10 +157,12 @@ in
|
|||
historyControlStr =
|
||||
concatStringsSep "\n" (mapAttrsToList (n: v: "${n}=${v}") (
|
||||
{
|
||||
HISTFILE = "\"${cfg.historyFile}\"";
|
||||
HISTFILESIZE = toString cfg.historyFileSize;
|
||||
HISTSIZE = toString cfg.historySize;
|
||||
}
|
||||
// optionalAttrs (cfg.historyFile != null) {
|
||||
HISTFILE = "\"${cfg.historyFile}\"";
|
||||
}
|
||||
// optionalAttrs (cfg.historyControl != []) {
|
||||
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue