{ description = "A very basic flake"; outputs = { self, nixpkgs }: { nixosModule = { config, lib, pkgs, ... }: with lib; let cfg = config.programs.myZsh; in { options = { programs.myZsh = { enable = mkEnableOption "Enable zsh"; }; }; config = mkIf cfg.enable { programs.zsh = { enable = true; shellAliases = { mkae = "make"; tw = "${pkgs.timewarrior}/bin/timew"; # ti = "${pkgs.timer}/bin/timer start $*"; # to = "${pkgs.timer}/bin/timer stop"; mutt = "${pkgs.neomutt}/bin/neomutt"; ls = "ls -N --color=auto"; # Play a sound of "rolling waves" # Taken from https://askubuntu.com/a/789472 # The 0.2 is the time for a wive # The 30 is the minimum amplitude # The amod means amplitude modulation noise = "${pkgs.sox}/bin/play -n synth brownnoise synth pinknoise mix synth sine amod 0.2 30"; ed = "${pkgs.myEmacs}/bin/emacsclient -c"; }; enableAutosuggestions = true; sessionVariables = { EDITOR = "${pkgs.myVim}/bin/vim"; PAGER = "less"; }; history = { save = 100000; size = 102000; ignoreDups = false; expireDuplicatesFirst = true; extended = true; share = true; path = "$HOME/.zhistory"; }; # http://zsh.sourceforge.net/Intro/intro_3.html # .zlogin is meant for programs to start on login shells # It is not meant for setting up aliases etc. # On the other hand, .zlogin is only invoked at *login*. initExtra = '' bindkey -v autoload -U edit-command-line zle -N edit-command-line bindkey "^?" backward-delete-char bindkey '^[OH' beginning-of-line bindkey '^[OF' end-of-line bindkey '^[[5~' up-line-or-history bindkey '^[[6~' down-line-or-history bindkey '^[[B' history-search-forward bindkey '^[[A' history-search-backward bindkey "^r" history-incremental-search-backward bindkey ' ' magic-space # also do history expansion on space bindkey '^E' complete-word # complete on tab, leave expansion to _expand bindkey ^e edit-command-line setopt prompt_sp # print lines without newlines properly eval "$(direnv hook zsh)" case $TERM in termite|*xterm*|rxvt|rxvt-unicode|rxvt-256color|rxvt-unicode-256color|(dt|k|E)term) precmd () { print -Pn "\e]0;$(pwd)\a" } preexec () { print -Pn "\e]0;$1\a" } ;; screen|screen-256color) precmd () { print -Pn "\e]83;title \"$1\"\a" print -Pn "\e]0;$TERM\a" } preexec () { print -Pn "\e]83;title \"$1\"\a" print -Pn "\e]0;$TERM - $1\a" } ;; esac wttr() { local request="wttr.in/''${1-Espoo}?M" [ "$(tput cols)" -lt 125 ] && request+='&n' curl -H "Accept-Language: ''${LANG%_*}" --compressed "$request" } totp() { ${pkgs.oathToolkit}/bin/oathtool --totp --base32 $(${pkgs.pass}/bin/pass show $1) } ${pkgs.remind}/bin/rem ''; plugins = [ { name = "wunjo"; src = ./zsh/wunjo; } { name = "gwp"; src = ./zsh/gwp; } ]; }; }; }; }; }