From 3ac955acf44e2155d1fef77c49b5c6f068e6e27b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Thu, 20 Jan 2022 14:53:35 +0100 Subject: [PATCH] nixos/system/build: Extract Modules that do not depend on e.g. toplevel should not have to include it just to set things in `system.build`. As a general rule, this keeps tests simple, usage flexible and evaluation fast. While one module is insignificant, consistency and good practices are. --- nixos/modules/system/activation/top-level.nix | 10 +--------- nixos/modules/system/build.nix | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 nixos/modules/system/build.nix diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index 8e53ec1ffab2..e10d668ad2cf 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -139,21 +139,13 @@ in { imports = [ + ../build.nix (mkRemovedOptionModule [ "nesting" "clone" ] "Use `specialisation.«name» = { inheritParentConfig = true; configuration = { ... }; }` instead.") (mkRemovedOptionModule [ "nesting" "children" ] "Use `specialisation.«name».configuration = { ... }` instead.") ]; options = { - system.build = mkOption { - internal = true; - default = {}; - type = with types; lazyAttrsOf (uniq unspecified); - description = '' - Attribute set of derivations used to setup the system. - ''; - }; - specialisation = mkOption { default = {}; example = lib.literalExpression "{ fewJobsManyCores.configuration = { nix.buildCores = 0; nix.maxJobs = 1; }; }"; diff --git a/nixos/modules/system/build.nix b/nixos/modules/system/build.nix new file mode 100644 index 000000000000..1539e5b53b0c --- /dev/null +++ b/nixos/modules/system/build.nix @@ -0,0 +1,18 @@ +{ lib, ... }: +let + inherit (lib) mkOption types; +in +{ + options = { + + system.build = mkOption { + internal = true; + default = {}; + type = with types; lazyAttrsOf (uniq unspecified); + description = '' + Attribute set of derivations used to set up the system. + ''; + }; + + }; +}