diff options
author | David Morgan <djm_uk@protonmail.com> | 2022-11-12 16:26:49 +0000 |
---|---|---|
committer | David Morgan <djm_uk@protonmail.com> | 2022-11-12 16:26:49 +0000 |
commit | 011c3d5f78e8a1afc6e02ae1ae40b786cf9ab34f (patch) | |
tree | 1cf37fc76901a150fd19b8bbc5130dacc3741e10 /nix-conf/home/includes | |
parent | c4b124267d74492f5154ee11495d39ac5aaed853 (diff) | |
download | dotfiles-011c3d5f78e8a1afc6e02ae1ae40b786cf9ab34f.tar.gz |
Add aliases and function for managing nix
Diffstat (limited to 'nix-conf/home/includes')
-rw-r--r-- | nix-conf/home/includes/zsh.nix | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix index 4cbb7ed..683cbfb 100644 --- a/nix-conf/home/includes/zsh.nix +++ b/nix-conf/home/includes/zsh.nix @@ -53,6 +53,8 @@ pp = "pushbullet push \"Pixel\" link \"\${1}\" \"\${1}\""; upgrade_emacs = "cp ~/.emacs.d/straight/versions/default.el straight-versions-default-`date \"+%Y-%m-%d-%H%M%S\"`.el && emacs --batch -l \"~/.emacs.d/init.el\" -f \"my/upgrade-packages\""; diff_emacs = "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'"; + nix-up = "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report"; + home-up = "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report"; # Git log aliases from the omz git plugin gl = "git pull"; @@ -117,6 +119,23 @@ function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) } + function gcd () { + if [ $# -eq 0 ] ; then + echo "Number of days must be specified" >&2 + return 1 + fi + if ! [[ $1 =~ '^[0-9]+$' ]] ; then + echo "Number of days must be a number" >&2 + return 2 + fi + + if [ $1 -eq 0 ] ; then + doas nix-collect-garbage -d + else + doas nix-collect-garbage --delete-older-than ''${1}d + fi + } + [[ ! -f ~/.zsh.local ]] || source ~/.zsh.local [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh |