diff --git a/modules/programs/zsh/history.nix b/modules/programs/zsh/history.nix index 19972c6aae..743bb192de 100644 --- a/modules/programs/zsh/history.nix +++ b/modules/programs/zsh/history.nix @@ -218,7 +218,7 @@ in cfg.history.ignorePatterns != [ ] ) "HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" cfg.history.ignorePatterns})"}"} HISTFILE="${mkShellVarPathStr cfg.history.path}" - mkdir -p "$(dirname "$HISTFILE")" + [[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}" '') (lib.mkIf (cfg.historySubstringSearch.enable or false) ( diff --git a/tests/modules/programs/fabric-ai/zshrc b/tests/modules/programs/fabric-ai/zshrc index d567f77ebc..68f7d74e8e 100644 --- a/tests/modules/programs/fabric-ai/zshrc +++ b/tests/modules/programs/fabric-ai/zshrc @@ -12,7 +12,7 @@ HISTSIZE="10000" SAVEHIST="10000" HISTFILE="/home/hm-user/.zsh_history" -mkdir -p "$(dirname "$HISTFILE")" +[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}" # Set shell options set_opts=( diff --git a/tests/modules/programs/zsh/aliases.nix b/tests/modules/programs/zsh/aliases.nix index b1456cf4fe..f7d9647e5e 100644 --- a/tests/modules/programs/zsh/aliases.nix +++ b/tests/modules/programs/zsh/aliases.nix @@ -29,7 +29,7 @@ SAVEHIST="10000" HISTFILE="/home/hm-user/.zsh_history" - mkdir -p "$(dirname "$HISTFILE")" + [[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}" # Set shell options set_opts=( diff --git a/tests/modules/programs/zsh/history-substring-search-expected.zshrc b/tests/modules/programs/zsh/history-substring-search-expected.zshrc index 7b23401067..0692af4a07 100644 --- a/tests/modules/programs/zsh/history-substring-search-expected.zshrc +++ b/tests/modules/programs/zsh/history-substring-search-expected.zshrc @@ -12,7 +12,7 @@ HISTSIZE="10000" SAVEHIST="10000" HISTFILE="/home/hm-user/.zsh_history" -mkdir -p "$(dirname "$HISTFILE")" +[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}" # Set shell options set_opts=( diff --git a/tests/modules/programs/zsh/smart-formatting-expected.zshrc b/tests/modules/programs/zsh/smart-formatting-expected.zshrc index 931c685ffe..33540b7a89 100644 --- a/tests/modules/programs/zsh/smart-formatting-expected.zshrc +++ b/tests/modules/programs/zsh/smart-formatting-expected.zshrc @@ -12,7 +12,7 @@ HISTSIZE="50000" SAVEHIST="50000" HISTFILE="/home/hm-user/.zsh_history" -mkdir -p "$(dirname "$HISTFILE")" +[[ -d ${HISTFILE:h} ]] || mkdir -p "${HISTFILE:h}" # Set shell options set_opts=( diff --git a/tests/modules/programs/zsh/zshrc-content-priorities.nix b/tests/modules/programs/zsh/zshrc-content-priorities.nix index f160c77138..e92f5783f1 100644 --- a/tests/modules/programs/zsh/zshrc-content-priorities.nix +++ b/tests/modules/programs/zsh/zshrc-content-priorities.nix @@ -69,7 +69,7 @@ SAVEHIST="10000" HISTFILE="/home/hm-user/.zsh_history" - mkdir -p "$(dirname "$HISTFILE")" + [[ -d ''${HISTFILE:h} ]] || mkdir -p "''${HISTFILE:h}" # Set shell options set_opts=(