19 # This attribute is responsible for creating boot entries for
20 # child configuration. They are only (directly) accessible
21 # when the parent configuration is boot default. For example,
22 # you can provide an easy way to boot the same configuration
23 # as you use, but with another kernel
26 childName: childConfig: childConfig.configuration.system.build.toplevel
27 ) config.specialisation;
32 isSpecialisation = mkOption {
33 type = lib.types.bool;
36 description = "Whether this system is a specialisation of another.";
39 specialisation = mkOption {
41 example = lib.literalExpression "{ fewJobsManyCores.configuration = { nix.settings = { core = 0; max-jobs = 1; }; }; }";
43 Additional configurations to build. If
44 `inheritParentConfig` is true, the system
45 will be based on the overall system configuration.
47 To switch to a specialised configuration
48 (e.g. `fewJobsManyCores`) at runtime, run:
51 sudo /run/current-system/specialisation/fewJobsManyCores/bin/switch-to-configuration test
54 type = types.attrsOf (
58 extend = if local.config.inheritParentConfig then extendModules else noUserModules.extendModules;
61 options.inheritParentConfig = mkOption {
64 description = "Include the entire system's configuration. Set to false to make a completely differently configured system.";
67 options.configuration = mkOption {
70 Arbitrary NixOS configuration.
72 Anything you can add to a normal NixOS configuration, you can add
73 here, including imports and config values, although nested
74 specialisations will be ignored.
77 inherit (extend { modules = [ ./no-clone.nix ]; }) type;
87 system.systemBuilderCommands = ''
88 mkdir $out/specialisation
89 ${concatStringsSep "\n" (
90 mapAttrsToList (name: path: "ln -s ${path} $out/specialisation/${name}") children
95 # uses extendModules to generate a type
96 meta.buildDocsInSandbox = false;