{ config, pkgs, lib, ... }: with lib; let cfg = config.programs.custom.zsh; in { options.programs.custom.zsh = { enable = mkEnableOption "enable zsh"; mainUser = mkOption { type = with types; nullOr str; default = null; description = '' the main User if available ''; }; }; config = mkIf cfg.enable { programs.zsh = { enable = true; enableCompletion = true; syntaxHighlighting.enable = true; ohMyZsh = { custom = "/etc/zshcustom/"; enable = false; # powerline themes # ---------------- theme = "powerlevel9k/powerlevel9k"; plugins = [ "git" "git-flow" "screen" "taskwarrior" "systemd" "tmux" "vi-mode" "wd" ]; }; #loginShellInit = '' # export TERM="xterm-256color" #''; shellAliases = { ls = "ls --color=tty"; l = "ls -CFh"; la = "ls -Ah"; ll = "ls -lh"; lt = "ls -lct --reverse"; less = "less -S"; top = "htop"; version = "date '+%Y%m%d%H%M%S'"; vclip = "xclip -selection clipboard"; df = "df -h"; timestamp = "date +%Y%m%d%H%M%S"; #nix-search = "nix-env -qaP"; #nix-list = ''nix-env -qaP "*" --description''; #nix-list-haskell = ''nix-env -f "" -qaP -A haskellPackages''; #nix-list-node = ''nix-env -f "" -qaP -A nodePackages''; #nix-list-beam = ''nix-env -f "" -qaP -A beamPackages''; #nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w"; nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/"; }; }; # only used to make quick config changes # -------------------------------------- #environment.etc."zshcustom/mainuser.zsh".source = # pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then '' # source ${config.users.users.mainUser.home}/.zshrc # '' else # "# programs.custom.zsh.mainUser not set "); # Theme # ----- #environment.etc."zshcustom/themes/powerlevel9k".source = # pkgs.fetchFromGitHub { # owner = "bhilburn"; # repo = "powerlevel9k"; # rev = "v0.6.4"; # sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5"; # }; #environment.etc."zshcustom/powerlevel9kpatch.zsh".source = # pkgs.writeText "powerlevel9kpatch.zsh" '' # # prompt elements # # --------------- # POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status) # POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=() # # # root_indicator # # -------------- # POWERLEVEL9K_ROOT_ICON="#" # POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black" # POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red" # ''; }; }