bash: Make sure HISTFILE's directory exists

Co-authored-by: Robert Helgesson <robert@rycee.net>
This commit is contained in:
Damien Cassou 2025-01-12 18:09:08 +01:00 committed by Robert Helgesson
parent 15bd673658
commit f99c704fe3
3 changed files with 24 additions and 2 deletions

View file

@ -180,7 +180,7 @@ in {
sessionVarsStr = config.lib.shell.exportAll cfg.sessionVariables;
historyControlStr = concatStringsSep "\n"
historyControlStr = (concatStringsSep "\n"
(mapAttrsToList (n: v: "${n}=${v}") ({
HISTFILESIZE = toString cfg.historyFileSize;
HISTSIZE = toString cfg.historySize;
@ -190,7 +190,8 @@ in {
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 ];