diff options
Diffstat (limited to 'hm/zsh/default.nix')
-rw-r--r-- | hm/zsh/default.nix | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/hm/zsh/default.nix b/hm/zsh/default.nix new file mode 100644 index 0000000..ea47f7a --- /dev/null +++ b/hm/zsh/default.nix @@ -0,0 +1,81 @@ +{ + config, + pkgs, + ... +}: { + programs.zsh = { + enable = true; + + syntaxHighlighting.enable = true; + autosuggestion.enable = true; + enableCompletion = true; + + autocd = true; + dotDir = ".config/zsh"; + + history = { + path = "${config.xdg.stateHome}/zsh/zsh_history"; + ignoreSpace = false; + save = 90000; + size = 90000; + }; + + historySubstringSearch.enable = true; + + sessionVariables = { + WALLPAPER = "${config.home.homeDirectory}/srv/wallpaper.jpg"; + }; + + shellAliases = { + vim = "nvim"; + ls = "lsd"; + l = "ls -l"; + la = "ls -a"; + lla = "ls -la"; + lt = "ls --tree"; + rebackup = "restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd backup"; + repreconf = "restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd"; + b-del = "sudo btrfs subv delet /srv/snapshots/home"; + b-shot = "sudo btrfs subvolume snapshot -r /home /srv/snapshots/home"; + b-home = ''[ -d /srv/snapshots/home ] && sudo btrfs subvolume delete /srv/snapshots/home; sudo btrfs subvolume snapshot -r /home /srv/snapshots/home; sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-dir /srv/.restic-cache backup /srv/snapshots/home;''; + r-clean = '' + sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache-dir /srv/.restic-cache forget \ + --keep-weekly 7 \ + --keep-daily 7 \ + --keep-monthly 6 \ + --keep-yearly 10 \ + --keep-hourly 5 \ + --keep-tag prs + ''; + r-prune = "sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd --cache- + dir /srv/.restic-cache prune"; + r-check = "sudo restic -r /mnt/storage/backups --cache-dir /srv/.restic-cache --password- + file ~/srv/.restic_pswd check"; + zconf = "nvim ~/.config/zsh/.zshrc"; + zenv = "nvim ~/.config/zsh/.zshenv"; + o = "xdg-open"; + wget = "wget --hsts-file=${config.xdg.dataHome}/wget-hsts"; + addagpl = "curl https://www.gnu.org/licenses/agpl-3.0.txt > COPYING"; + addgpl = "curl https://www.gnu.org/licenses/gpl-3.0.txt > COPYING"; + }; + + initExtraFirst = + builtins.readFile ./config/instant-prompt.zsh + + "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; + # + + initExtra = + '' + export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh/ + export fpath=("$XDG_DATA_HOME/zsh/site-functions" $fpath) + HISTFILE="$XDG_STATE_HOME/zsh/history" + + plugins=(git) + + + + source $ZSH/oh-my-zsh.sh + '' + + builtins.readFile ./config/p10k.zsh + + builtins.readFile ./config/functions.zsh; + }; +} |