summary refs log tree commit diff stats
path: root/user/settings
diff options
context:
space:
mode:
authorAlan Pearce2020-06-04 13:33:54 +0200
committerAlan Pearce2020-06-04 13:33:54 +0200
commit0688b5ad70ba0a3636dbf401c758b3753de8ec36 (patch)
tree4e09dbb75b9859e147232ad475a5a017d1bb7990 /user/settings
parent5741c855a066ed7e06f1a957ff11774b7cef9dda (diff)
downloadnixfiles-0688b5ad70ba0a3636dbf401c758b3753de8ec36.tar.lz
nixfiles-0688b5ad70ba0a3636dbf401c758b3753de8ec36.tar.zst
nixfiles-0688b5ad70ba0a3636dbf401c758b3753de8ec36.zip
zsh: move history (with migration path)
Diffstat (limited to 'user/settings')
-rw-r--r--user/settings/zsh.nix8
1 files changed, 7 insertions, 1 deletions
diff --git a/user/settings/zsh.nix b/user/settings/zsh.nix
index f0030b0c..0efda5de 100644
--- a/user/settings/zsh.nix
+++ b/user/settings/zsh.nix
@@ -29,6 +29,12 @@ in
     zsh-completions
   ];
 
+  home.activation.linkOldZshHistory = config.lib.dag.entryAfter ["writeBoundary"] ''
+    if [[ ! -f ''${XDG_DATA_HOME}/zsh/history ]]; then
+      ln ${toString ./.cache/zsh/history} ''${XDG_DATA_HOME}/zsh/history
+    fi
+  '';
+
   programs.zsh = {
     enable = true;
 
@@ -41,7 +47,7 @@ in
     history = {
       expireDuplicatesFirst = true;
       extended = true;
-      path = ".cache/zsh/history";
+      path = "\${XDG_DATA_HOME#$HOME/}/zsh/history";
       save = 20000;
       size = 10000;
       share = false;