devshell: Add command to build and switch to NixOS config

This commit is contained in:
Jack O'Sullivan 2022-09-09 12:15:25 +01:00
parent 5157ca2541
commit 926209d168

View File

@ -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";