mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge pull request #144094 from hercules-ci/nixos-specialisations-use-extendModules
nixos/specialisation: Rephrase in terms of extendModules, noUserModules
This commit is contained in:
commit
8a129f8cf0
2 changed files with 32 additions and 21 deletions
|
@ -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
|
||||
|
@ -169,7 +163,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;
|
||||
|
@ -178,7 +176,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;
|
||||
};
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue