summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorIzorkin <izorkin@elven.pw>2019-03-18 17:07:25 +0300
committerIzorkin <izorkin@elven.pw>2019-03-18 19:57:54 +0300
commit53d05fd0ccd5462550f6fdee9ae465f6c2080473 (patch)
treefb9c21e29040b16026a13b039b6843f2febd0425 /nixos/modules/programs
parentc94f6f22d89668bb0c64db0e77d26f69e27eb395 (diff)
downloadnixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar.gz
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar.bz2
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar.lz
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar.xz
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.tar.zst
nixpkgs-53d05fd0ccd5462550f6fdee9ae465f6c2080473.zip
nixos/zsh: enable configure history and custom options
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/zsh/zsh.nix36
1 files changed, 31 insertions, 5 deletions
diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix
index 164d8db5859..4b995b66a26 100644
--- a/nixos/modules/programs/zsh/zsh.nix
+++ b/nixos/modules/programs/zsh/zsh.nix
@@ -79,6 +79,33 @@ in
         type = types.lines;
       };
 
+      histSize = mkOption {
+        default = 2000;
+        description = ''
+          Change history size.
+        '';
+        type = types.int;
+      };
+
+      histFile = mkOption {
+        default = "$HOME/.zsh_history";
+        description = ''
+          Change history file.
+        '';
+        type = types.str;
+      };
+
+      setOptions = mkOption {
+        type = types.listOf types.str;
+        default = [
+          "HIST_IGNORE_DUPS" "SHARE_HISTORY" "HIST_FCNTL_LOCK"
+        ];
+        example = [ "EXTENDED_HISTORY" "RM_STAR_WAIT" ];
+        description = ''
+          Configure zsh options.
+        '';
+      };
+
       enableCompletion = mkOption {
         default = true;
         description = ''
@@ -162,12 +189,11 @@ in
 
         . /etc/zinputrc
 
-        # history defaults
-        SAVEHIST=2000
-        HISTSIZE=2000
-        HISTFILE=$HOME/.zsh_history
+        export SAVEHIST=${toString cfg.histSize}
+        export HISTSIZE=${toString cfg.histSize}
+        export HISTFILE=${cfg.histFile}
 
-        setopt HIST_IGNORE_DUPS SHARE_HISTORY HIST_FCNTL_LOCK
+        ${optionalString (cfg.setOptions != []) "setopt ${concatStringsSep " " cfg.setOptions}"}
 
         HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"