Commit 1fc2b6576189

Vincent Demeester <vincent@sbr.pm>
2020-12-04 11:57:16
system: add a boot target…
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 2ca6fed
Changed files (2)
tools
system
tools/system/system
@@ -47,6 +47,18 @@ function switch() {
         error "Failed to activate system"
 }
 
+function boot() {
+    [ "$#" -eq 0 ] || error "switch"
+    build
+    local switch_bin="$WORK_DIR/bin/switch-to-configuration"
+    sudo nix-env --set \
+        --profile "/nix/var/nix/profiles/system" \
+        "$WORK_DIR" ||
+        error "Failed to activate profile"
+    sudo "$switch_bin" "boot" ||
+        error "Failed to activate system"
+}
+
 function main() {
     for target in $@; do
         $target
Makefile
@@ -51,6 +51,10 @@ dry-build: secrets setup
 switch: secrets
 	./bin/system switch
 
+.PHONY: boot
+boot: secrets
+	./bin/system boot
+
 .PHONY: install-hooks
 install-hooks:
 	if [ -e .git ]; then nix-shell -p git --run 'git config core.hooksPath .githooks'; fi