about summary refs log tree commit diff
path: root/users/glittershark/system/home/modules/common.nix
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2021-03-28T21·16-0400
committerglittershark <grfn@gws.fyi>2021-03-29T00·00+0000
commitc3f35caefa65b117f2590108f2fe2ecc2750721c (patch)
tree6a05bcd9ab24e5d98ce7e681cc29c5861ac26a53 /users/glittershark/system/home/modules/common.nix
parent8e13b1303a0d152c2f3b68f2421163e94fdf226c (diff)
refactor(gs/home): Move rebuild-mugwump script to all machines r/2357
Chupacabra doesn't even exist anymore, plus I want this installed on all
home systems

Change-Id: Id0e5c89797b1ad52b2a24d60ad3ab5e125f60266
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2696
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/glittershark/system/home/modules/common.nix')
-rw-r--r--users/glittershark/system/home/modules/common.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/users/glittershark/system/home/modules/common.nix b/users/glittershark/system/home/modules/common.nix
index 0b295a450b61..d420595adb1d 100644
--- a/users/glittershark/system/home/modules/common.nix
+++ b/users/glittershark/system/home/modules/common.nix
@@ -44,6 +44,16 @@
     nix-prefetch-github
     nix-review
     cachix
+    (writeShellScriptBin "rebuild-mugwump" ''
+      set -eo pipefail
+      cd ~/code/depot
+      nix build -f . users.glittershark.system.system.mugwumpSystem -o /tmp/mugwump
+      nix copy -f . users.glittershark.system.system.mugwumpSystem \
+        --to ssh://mugwump
+      system=$(readlink -ef /tmp/mugwump)
+      ssh mugwump sudo nix-env -p /nix/var/nix/profiles/system --set $system
+      ssh mugwump sudo $system/bin/switch-to-configuration switch
+    '')
   ];
 
   programs.ssh = {