about summary refs log tree commit diff stats
path: root/nix-conf
diff options
context:
space:
mode:
Diffstat (limited to 'nix-conf')
-rw-r--r--nix-conf/home/includes/zsh.nix19
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