From 3a591863b01d275a472ae6706bb58ed4794b305e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= <tm@tlater.net>
Date: Sun, 18 Aug 2024 17:36:45 +0200
Subject: [PATCH] flake.nix: Add default package to allow easily creating gc
 root

---
 flake.nix | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/flake.nix b/flake.nix
index e3ff531..56f3972 100644
--- a/flake.nix
+++ b/flake.nix
@@ -43,6 +43,16 @@
     let
       system = "x86_64-linux";
       pkgs = nixpkgs.legacyPackages.${system};
+
+      vm = nixpkgs.lib.nixosSystem {
+        inherit system;
+        specialArgs.flake-inputs = inputs;
+
+        modules = [
+          ./configuration
+          ./configuration/hardware-specific/vm.nix
+        ];
+      };
     in
     {
       ##################
@@ -83,6 +93,12 @@
       #########
       checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
 
+      ###########################
+      # Garbage collection root #
+      ###########################
+
+      packages.${system}.default = vm.config.system.build.vm;
+
       ###################
       # Utility scripts #
       ###################
@@ -93,15 +109,6 @@
           type = "app";
           program =
             let
-              vm = nixpkgs.lib.nixosSystem {
-                inherit system;
-                specialArgs.flake-inputs = inputs;
-
-                modules = [
-                  ./configuration
-                  ./configuration/hardware-specific/vm.nix
-                ];
-              };
             in
             (pkgs.writeShellScript "" ''
               ${vm.config.system.build.vm.outPath}/bin/run-testvm-vm