From 926209d16822c2aa4c645ee37121c98c61542395 Mon Sep 17 00:00:00 2001 From: Jack O'Sullivan Date: Fri, 9 Sep 2022 12:15:25 +0100 Subject: [PATCH] devshell: Add command to build and switch to NixOS config --- devshell/commands.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/devshell/commands.nix b/devshell/commands.nix index 97f138e..53dc9d3 100644 --- a/devshell/commands.nix +++ b/devshell/commands.nix @@ -73,6 +73,15 @@ in help = "Build NixOS configuration"; command = ''nix build "''${@:2}" ".#nixosConfigurations.\"$1\".config.system.build.toplevel"''; } + { + name = "build-n-switch"; + category = "tasks"; + help = "Build NixOS configuration for the current host and run `switch-to-configuration`"; + command = '' + path="$(nix build --no-link --print-out-paths ".#nixosConfigurations.\"$(hostname)\".config.system.build.toplevel")" + doas "$path"/bin/switch-to-configuration "$@" + ''; + } { name = "run-vm"; category = "tasks";