From 0d139aa66f6b9da34255ef2f8f9212c546c1dfec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Sat, 4 May 2024 23:20:30 +0200 Subject: [PATCH] [feature] justfile: add build-vm and run-vm commands --- README.md | 9 +++------ justfile | 6 ++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6ce3a64..bc73479 100644 --- a/README.md +++ b/README.md @@ -14,14 +14,11 @@ looking at it :p (maybe you can also learn some stuff on the way). ## Try out in a VM -If you already have nix you can run the following commands: +If you already have nix you can run the following command to try this +configuration in a vm: ```console -$ nix run nixpkgs#nixos-rebuild -- build-vm --flake .#vm -building the system configuration... - -Done. The virtual machine can be started by running /nix/store/$hash-nixos-vm/bin/run-nixos-vm -$ /nix/store/$hash-nixos-vm/bin/run-nixos-vm $QEMU_OPTS_WL +$ just run-vm ``` The default user is `jdoe` and the default password is `example`. diff --git a/justfile b/justfile index f7ba265..8261c08 100644 --- a/justfile +++ b/justfile @@ -5,6 +5,12 @@ default: update input: nix flake lock --update-input {{input}} --commit-lock-file +build-vm: + nixos-rebuild build-vm --flake .#vm --print-build-logs + +run-vm: build-vm + QEMU_OPTS="$QEMU_OPTS_WL" result/bin/run-nixos-vm + # Amend Update flake.lock PR flake-pr: git branch -D update_flake_lock_action || echo "no previous update branch"