summary refs log tree commit diff
path: root/nixos/modules/system/activation/top-level.nix
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2021-11-01 10:59:47 +0100
committerRobert Hensing <robert@roberthensing.nl>2021-11-01 10:59:47 +0100
commitb5681a7a4096b81101626a0853c28bede0495490 (patch)
tree0df0f994177abacc30538454ae231a260fec2f89 /nixos/modules/system/activation/top-level.nix
parent6d7a5212c5c2cb8a873477927078ed53a028307b (diff)
downloadnixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar.gz
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar.bz2
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar.lz
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar.xz
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.tar.zst
nixpkgs-b5681a7a4096b81101626a0853c28bede0495490.zip
nixos/specialisation: Rephrase in terms of extendModules, noUserModules
By using the new extendModules function to produce the specialisations,
we avoid reimplementing the eval-config.nix logic in reverse and fix
cross compilation support for specialisations in the process.
Diffstat (limited to 'nixos/modules/system/activation/top-level.nix')
-rw-r--r--nixos/modules/system/activation/top-level.nix32
1 files changed, 19 insertions, 13 deletions
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index 68da910d29c..8266622e78d 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, modules, baseModules, specialArgs, ... }:
+{ config, lib, pkgs, extendModules, noUserModules, ... }:
 
 with lib;
 
@@ -11,16 +11,10 @@ let
   # you can provide an easy way to boot the same configuration
   # as you use, but with another kernel
   # !!! fix this
-  children = mapAttrs (childName: childConfig:
-      (import ../../../lib/eval-config.nix {
-        inherit lib baseModules specialArgs;
-        system = config.nixpkgs.initialSystem;
-        modules =
-           (optionals childConfig.inheritParentConfig modules)
-        ++ [ ./no-clone.nix ]
-        ++ [ childConfig.configuration ];
-      }).config.system.build.toplevel
-    ) config.specialisation;
+  children =
+    mapAttrs
+      (childName: childConfig: childConfig.configuration.system.build.toplevel)
+      config.specialisation;
 
   systemBuilder =
     let
@@ -176,7 +170,11 @@ in
         </screen>
       '';
       type = types.attrsOf (types.submodule (
-        { ... }: {
+        local@{ ... }: let
+          extend = if local.config.inheritParentConfig
+            then extendModules
+            else noUserModules.extendModules;
+        in {
           options.inheritParentConfig = mkOption {
             type = types.bool;
             default = true;
@@ -185,7 +183,15 @@ in
 
           options.configuration = mkOption {
             default = {};
-            description = "Arbitrary NixOS configuration options.";
+            description = ''
+              Arbitrary NixOS configuration.
+
+              Anything you can add to a normal NixOS configuration, you can add
+              here, including imports and config values, although nested
+              specialisations will be ignored.
+            '';
+            visible = "shallow";
+            inherit (extend { modules = [ ./no-clone.nix ]; }) type;
           };
         })
       );