about summary refs log tree commit diff
path: root/pkgs/profpatsch/deploy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/profpatsch/deploy.nix')
-rw-r--r--pkgs/profpatsch/deploy.nix17
1 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/profpatsch/deploy.nix b/pkgs/profpatsch/deploy.nix
index ddd6eeac..863fe4c7 100644
--- a/pkgs/profpatsch/deploy.nix
+++ b/pkgs/profpatsch/deploy.nix
@@ -4,7 +4,7 @@
 let
   bins = getBins pkgs.coreutils [ "realpath" ]
       // getBins pkgs.openssh [ "ssh" ]
-      // getBins pkgs.nix [ "nix-build" "nix-copy-closure" ]
+      // getBins pkgs.nix [ "nix-build" "nix-copy-closure" "nix-env" ]
       ;
 
   deploy = pkgs.writers.writeDash "deploy-machine-profpatsch" ''
@@ -21,16 +21,25 @@ let
       -A "machines.profpatsch.$MACHINE.build" \
       "$VUIZVUI"
 
+    # copy all required paths to the machine
     ${bins.nix-copy-closure} \
       --to "$MACHINE?compress=true" \
       --use-substitutes \
+      ${create-system-profile-and-switch} \
       "$OUT_LINK"
 
-
+    # activate the system
     ${bins.ssh} \
       "root@$MACHINE" \
-      "$(${bins.realpath} $OUT_LINK)/bin/switch-to-configuration" \
-      "switch"
+      ${create-system-profile-and-switch} \
+      "$(${bins.realpath} $OUT_LINK)"
+  '';
+
+  create-system-profile-and-switch = pkgs.writers.writeDash "create-system-profile-and-switch" ''
+    set -e
+    system="$1"
+    ${bins.nix-env} -p /nix/var/nix/profiles/system --set $system
+    $system/bin/switch-to-configuration switch
   '';
 
 in {