summary refs log tree commit diff stats
path: root/zsh.nix
blob: ab44a297788bc7f417c2a6ff2e7a406435371b4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ config, pkgs, ... }:

{
	environment.systemPackages = with pkgs; [ 
		zsh-powerlevel10k # shell theme
		oh-my-zsh # configuration framework
	];
	programs.zsh.enable = true;
	programs.zsh.syntaxHighlighting.enable = true;
	programs.zsh.autosuggestions.enable = true;
	programs.zsh.interactiveShellInit = ''
	   	export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh/
		export fpath=("$XDG_DATA_HOME/zsh/site-functions" $fpath)
		export HISTFILE="$XDG_STATE_HOME/zsh/history"

		#ZSH_THEME="powerlevel10k/powerlevel10k"
		# ZSH_CUSTOM=/path/to/new-custom-folder

		plugins=(git zsh-syntax-highlighting zsh-autosuggestions)

# export LANG=en_US.UTF-8

		export EDITOR='nvim'
		export GOPATH="$XDG_DATA_HOME/go"
		alias vim="nvim"
		alias ls='lsd'
		alias l='ls -l'
		alias la='ls -a'
		alias lla='ls -la'
		alias lt='ls --tree'
		alias rebackup='restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd backup'
		alias repreconf='restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd'
		alias b-del="sudo btrfs subv delet /srv/snapshots/home"
		alias b-shot="sudo btrfs subvolume snapshot -r /home /srv/snapshots/home"
		alias ba='[ -d /srv/snapshots/home ] && sudo btrfs subvolume delete /srv/snapshots/home; [ -d /srv/snapshots/root ] && sudo btrfs subvolume delete /srv/snapshots/root; sudo btrfs subvolume snapshot -r /home /srv/snapshots/home; sudo btrfs subvolume snapshot -r / /srv/snapshots/root; sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd backup /srv/snapshots/home; sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd backup /srv/snapshots/root;'
		alias r-clean="sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd forget \
                        	--keep-weekly  7  \
                        	--keep-daily   7  \
                        	--keep-monthly 6  \
                        	--keep-yearly  10 \
                        	--keep-hourly  5  \
                        	--keep-tag prs"
		alias r-prune="sudo restic -r /mnt/storage/backups --password-file ~/srv/restic_pswd prune"
		alias r-check="sudo restic -r /mnt/storage/backups --cache-dir /root/.cache --password-file ~/srv/.restic_pswd check"
		alias zconf="vim ~/.config/zsh/.zshrc"
		alias zenv="vim ~/.config/zsh/.zshenv"
		alias o="xdg-open"
		alias wget=wget --hsts-file="$XDG_DATA_HOME/wget-hsts"
    		

		source $ZSH/oh-my-zsh.sh
		clear
	 	'';

 	programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}