difftreelog
feat set nixpkgs.hostPlatform
in: trunk
1 file changed
modules/nixos.nixdiffbeforeafterboth1{2 lib,3 fleetLib,4 inputs,5 self,6 config,7 _fleetFlakeRootConfig,8 ...9}:10let11 inherit (lib.attrsets) mapAttrs;12 inherit (lib.options) mkOption;13 inherit (lib.types) deferredModule unspecified;14 inherit (lib.modules) mkRemovedOptionModule;15 inherit (lib.strings) escapeNixIdentifier;16 inherit (fleetLib.options) mkHostsOption;1718 _file = ./nixos.nix;19in20{21 options = {22 nixos = mkOption {23 description = ''24 Shared nixos configuration module for all hosts.25 '';26 type = deferredModule;27 };28 hosts = mkHostsOption (hostArgs: {29 inherit _file;30 options = {31 nixos = mkOption {32 description = ''33 Nixos configuration for the current host.34 '';35 type = deferredModule;36 apply =37 module:38 let39 inherit (hostArgs.config) system;40 modulesPath = "${config.nixpkgs.buildUsing}/nixos/modules";41 in42 config.nixpkgs.buildUsing.lib.evalModules {43 class = "nixos";44 prefix = ["fleetConfiguration" "hosts" hostArgs.config._module.args.name "nixos"];45 modules = (import "${modulesPath}/module-list.nix") ++ [46 (module // { key = "attr<host.nixos>"; })47 (config.nixos // { key = "attr<fleet.nixos>"; })48 ];49 specialArgs = {50 inherit fleetLib inputs self modulesPath;51 inputs' = mapAttrs (52 inputName: input:53 builtins.addErrorContext54 "while retrieving system-dependent attributes for input ${escapeNixIdentifierinputName}"55 (56 if input._type or null == "flake" then57 _fleetFlakeRootConfig.perInput system input58 else59 "input is not a flake, perhaps flake = false was added to te input declaration?"60 )61 ) inputs;62 self' = builtins.addErrorContext "while retrieving system-dependent attributes for a flake's own outputs" (63 _fleetFlakeRootConfig.perInput system self64 );65 };66 };67 };68 nixos_unchecked = mkOption {69 type = unspecified;70 };71 };72 config = {73 # imports = [74 # (mkRemovedOptionModule ["nixosModules"] "replaced with hosts.*.nixos.imports.")75 # ];76 nixos = {77 _module.args = {78 nixosHosts = mapAttrs (_: value: value.nixos_unchecked.config) config.hosts;79 hosts = config.hosts;80 host = hostArgs.config;81 fleetConfiguration = config;82 };83 };84 nixos_unchecked = hostArgs.config.nixos.extendModules {85 modules = [86 {87 _module.check = false;88 }89 ];90 };91 };92 });93 };94 imports = [95 (mkRemovedOptionModule [ "nixosModules" ] "replaced with nixos.imports.")96 ];97 config.nixos.imports = import ./nixos/module-list.nix;98}