mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
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
1 changed files with 5 additions and 3 deletions
|
@ -30,8 +30,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
historyFile = mkOption {
|
historyFile = mkOption {
|
||||||
type = types.str;
|
type = types.nullOr types.str;
|
||||||
default = "$HOME/.bash_history";
|
default = null;
|
||||||
description = "Location of the bash history file.";
|
description = "Location of the bash history file.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,10 +157,12 @@ in
|
||||||
historyControlStr =
|
historyControlStr =
|
||||||
concatStringsSep "\n" (mapAttrsToList (n: v: "${n}=${v}") (
|
concatStringsSep "\n" (mapAttrsToList (n: v: "${n}=${v}") (
|
||||||
{
|
{
|
||||||
HISTFILE = "\"${cfg.historyFile}\"";
|
|
||||||
HISTFILESIZE = toString cfg.historyFileSize;
|
HISTFILESIZE = toString cfg.historyFileSize;
|
||||||
HISTSIZE = toString cfg.historySize;
|
HISTSIZE = toString cfg.historySize;
|
||||||
}
|
}
|
||||||
|
// optionalAttrs (cfg.historyFile != null) {
|
||||||
|
HISTFILE = "\"${cfg.historyFile}\"";
|
||||||
|
}
|
||||||
// optionalAttrs (cfg.historyControl != []) {
|
// optionalAttrs (cfg.historyControl != []) {
|
||||||
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
|
HISTCONTROL = concatStringsSep ":" cfg.historyControl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue