From 6510ec5acdd465a016e5671ffa99460ef70e6c25 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Fri, 17 Dec 2021 14:34:30 +0100 Subject: [PATCH] nixos: Make system.build.vm a standard attribute based on vmVariant --- flake.nix | 5 ----- nixos/default.nix | 4 +--- nixos/modules/virtualisation/build-vm.nix | 11 ++++++++++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 3060ffdd649e..01d52ae38624 100644 --- a/flake.nix +++ b/flake.nix @@ -45,11 +45,6 @@ system.nixos.versionSuffix = ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}"; system.nixos.revision = final.mkIf (self ? rev) self.rev; - - system.build = { - vm = lib.mkDefault config.virtualisation.vmVariant.system.build.vm; - vmWithBootLoader = lib.mkDefault config.virtualisation.vmVariantWithBootLoader.system.build.vm; - }; }) ]; }); diff --git a/nixos/default.nix b/nixos/default.nix index 27a0fd73ecd7..6beb4cd3a7df 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -16,7 +16,5 @@ in system = eval.config.system.build.toplevel; - vm = eval.config.virtualisation.vmVariant.system.build.vm; - - vmWithBootLoader = eval.config.virtualisation.vmVariantWithBootLoader.system.build.vm; + inherit (eval.config.system.build) vm vmWithBootLoader; } diff --git a/nixos/modules/virtualisation/build-vm.nix b/nixos/modules/virtualisation/build-vm.nix index d856b1b502b6..3baa84cce018 100644 --- a/nixos/modules/virtualisation/build-vm.nix +++ b/nixos/modules/virtualisation/build-vm.nix @@ -1,4 +1,4 @@ -{ extendModules, lib, ... }: +{ config, extendModules, lib, ... }: let inherit (lib) @@ -43,4 +43,13 @@ in }; }; + + config = { + + system.build = { + vm = lib.mkDefault config.virtualisation.vmVariant.system.build.vm; + vmWithBootLoader = lib.mkDefault config.virtualisation.vmVariantWithBootLoader.system.build.vm; + }; + + }; }