diff options
Diffstat (limited to 'home/zsh/default.nix')
-rw-r--r-- | home/zsh/default.nix | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/home/zsh/default.nix b/home/zsh/default.nix new file mode 100644 index 0000000..0ee9e43 --- /dev/null +++ b/home/zsh/default.nix @@ -0,0 +1,56 @@ +{ config, pkgs, lib, ... }: +let cfg = config.my.home.zsh; +in { + options.my.home.zsh = with lib; { + enable = mkEnableOption "zsh configuration"; + }; + + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ zsh-completions ]; + + programs.zsh = { + enable = true; + dotDir = ".config/zsh"; + enableCompletion = true; + + history = { + size = 500000; + save = 500000; + extended = false; + ignoreSpace = true; + ignoreDups = true; + share = false; + # see + # https://github.com/nix-community/home-manager/blob/32a7da69dc53c9eb5ad0675eb7fdc58f7fe35272/modules/programs/zsh.nix#L537 + path = ".local/share/zsh/zsh_history"; + }; + + localVariables = { + # Print timing statistics for everything which takes longer than 5 seconds of + # user + system time. + REPORTTIME = 5; + }; + + shellAliases = { + ll = "ls -l --color=auto"; + lt = "ls -ltrh --color=auto"; + drone = "DRONE_TOKEN=$(pass api/drone.fcuny.xyz) drone"; + }; + + defaultKeymap = "emacs"; + + initExtraFirst = '' + if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + exec sway + fi + ''; + + initExtra = lib.concatMapStrings builtins.readFile [ + ./completion-style.zsh + ./options.zsh + ./prompt.zsh + ./tmux.zsh + ]; + }; + }; +} |