]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - systems/dilion/vms/base_image.nix
Squash changes containing private information
[perso/Immae/Config/Nix.git] / systems / dilion / vms / base_image.nix
similarity index 82%
rename from modules/private/system/dilion/vms/base_image.nix
rename to systems/dilion/vms/base_image.nix
index 8de85600dbddee6911c42be6a1009572139c4632..46b90eb7e2992b8ac2c6ff1942798847bd1029ac 100644 (file)
@@ -1,10 +1,14 @@
-configuration_file: { pkgs ? import <nixpkgs> {}, system ? builtins.currentSystem, myEnv, ... }:
+configuration_file: { pkgs, myEnv, nixpkgs, environment, pkgs-no-overlay, ... }:
 let
-  config = (import <nixpkgs/nixos/lib/eval-config.nix> {
-    inherit system;
+  config = (import (nixpkgs + "/nixos/lib/eval-config.nix") {
+    inherit (pkgs) system;
     modules = [ {
+      _module.args.environment = environment;
       myEnv = myEnv;
-      imports = [ configuration_file ];
+      imports = [
+        (nixpkgs + "/nixos/modules/profiles/qemu-guest.nix")
+        configuration_file
+      ];
 
       # We want our template image to be as small as possible, but the deployed image should be able to be
       # of any size. Hence we resize on the first boot.
@@ -22,7 +26,7 @@ let
       };
     } ];
   }).config;
-in pkgs.vmTools.runInLinuxVM (
+in pkgs-no-overlay.vmTools.runInLinuxVM (
   pkgs.runCommand "nixos-base-image"
     {
       memSize = 768;
@@ -30,13 +34,13 @@ in pkgs.vmTools.runInLinuxVM (
         ''
           mkdir $out
           diskImage=image.qcow2
-          ${pkgs.vmTools.qemu}/bin/qemu-img create -f qcow2 $diskImage 2G
+          ${pkgs-no-overlay.vmTools.qemu}/bin/qemu-img create -f qcow2 $diskImage 2G
           mv closure xchg/
         '';
       postVM =
         ''
           echo compressing VM image...
-          ${pkgs.vmTools.qemu}/bin/qemu-img convert -c $diskImage -O qcow2 $out/nixos.qcow2
+          ${pkgs-no-overlay.vmTools.qemu}/bin/qemu-img convert -c $diskImage -O qcow2 $out/nixos.qcow2
         '';
       buildInputs = [ pkgs.utillinux pkgs.perl pkgs.parted pkgs.e2fsprogs ];
       exportReferencesGraph =