summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-01-16 18:29:46 +0100
committerFranz Pletz <fpletz@fnordicwalking.de>2018-01-16 17:29:46 +0000
commitb55d4c0564b0bde4cbc0c01b6ba7a1276382335a (patch)
tree2b6a21f08f3e1081370facf3f7df1d704ba95985 /nixos/modules/programs
parent13b4f440fc7accaf800345a81af548f8f89db08f (diff)
downloadnixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar.gz
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar.bz2
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar.lz
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar.xz
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.tar.zst
nixlib-b55d4c0564b0bde4cbc0c01b6ba7a1276382335a.zip
programs.zsh.ohMyZsh: add `cacheDir` option (#33150)
The default cache directory set by oh-my-zsh is $ohMyZsh/cache which
lives in the Nix store in our case. This causes issues with several
completion plugins provided by oh-my-zsh.
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/zsh/oh-my-zsh.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/nixos/modules/programs/zsh/oh-my-zsh.nix b/nixos/modules/programs/zsh/oh-my-zsh.nix
index 9077643c4440..b7834fa5f872 100644
--- a/nixos/modules/programs/zsh/oh-my-zsh.nix
+++ b/nixos/modules/programs/zsh/oh-my-zsh.nix
@@ -48,6 +48,15 @@ in
             Name of the theme to be used by oh-my-zsh.
           '';
         };
+
+        cacheDir = mkOption {
+          default = "$HOME/.cache/oh-my-zsh";
+          type = types.str;
+          description = ''
+            Cache directory to be used by `oh-my-zsh`.
+            Default is /nix/store/<oh-my-zsh>/cache.
+          '';
+        };
       };
     };
 
@@ -74,6 +83,13 @@ in
           "ZSH_THEME=\"${cfg.theme}\""
         }
 
+        ${optionalString (cfg.cacheDir != null) ''
+          if [[ ! -d "${cfg.cacheDir}" ]]; then
+            mkdir -p "${cfg.cacheDir}"
+          fi
+          ZSH_CACHE_DIR=${cfg.cacheDir}
+        ''}
+
         source $ZSH/oh-my-zsh.sh
       '';
     };