From 48f223a030cf24668690ff269d0d8081004831f8 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Mon, 13 May 2024 20:23:55 -0400 Subject: [PATCH] added vm build script --- justfile | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/justfile b/justfile index 5dd2ab3..7bc8e0b 100644 --- a/justfile +++ b/justfile @@ -35,7 +35,7 @@ test TYPE="nix" SYSTEM="desktop": ;; esac -# Build the nix expression and hydrate the results directory +# Build the nix expression and hydrate the results directory - pass VM flag to build a VM build TYPE="nix" SYSTEM="desktop": #!/usr/bin/env bash set -euo pipefail @@ -60,8 +60,24 @@ build TYPE="nix" SYSTEM="desktop": nix build --dry-run .#homeConfigurations."workstation".config.home-manager.build.toplevel -L exit 0 ;; + "vm") + if [ "{{SYSTEM}}" = "desktop" ] || [ "{{SYSTEM}}" = "server" ] || [ "{{SYSTEM}}" = "wsl" ] || [ "{{SYSTEM}}" = "laptop" ]; then + echo "Building VM for {{SYSTEM}}..." + nixos-rebuild build-vm --flake .#{{SYSTEM}} + result/bin/run-{{SYSTEM}}-vm + exit 0 + else + echo "Error: Unknown argument - '{{SYSTEM}}'" + echo "Use one of:" + echo " desktop" + echo " server" + echo " laptop" + echo " wsl" + exit 1 + fi + ;; *) - echo "Invalid usage: {{TYPE}}."; + echo "Invalid usage: {{TYPE}}." echo "Use one of:" echo " nixos" echo " home"