diff --git a/flake.lock b/flake.lock index 13482c4f..6d239faa 100644 --- a/flake.lock +++ b/flake.lock @@ -81,7 +81,7 @@ "utils": "utils_2" }, "locked": { - "narHash": "sha256-clwJnNLVOASak2CfkWu3Yztb1uWwtndY4VLDWEa9R3s=", + "narHash": "sha256-TOrVXGFk5rt1Wn14ja2spg44NuZnFM/V6qguQfO+8Kc=", "path": "./lib", "type": "path" }, @@ -355,11 +355,11 @@ "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1619480667, - "narHash": "sha256-KBiMpZcCv7D3wQ51ow7Sq8Xl01hDiRp5f7Py93CeD40=", + "lastModified": 1619532520, + "narHash": "sha256-+xIFAW5J0AcxwAflAX1gg/C8kfaqeZbS4XAZusCrZPY=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "be032a4396ad4cd7ea9bb733db8e456ec339ac9c", + "rev": "8eb7f9206713a528174c20c5133521dc37e2bfb1", "type": "github" }, "original": { diff --git a/lib/flake.lock b/lib/flake.lock index eda785b8..ebf5e6d3 100644 --- a/lib/flake.lock +++ b/lib/flake.lock @@ -146,11 +146,11 @@ "flake-utils": "flake-utils" }, "locked": { - "lastModified": 1619480667, - "narHash": "sha256-KBiMpZcCv7D3wQ51ow7Sq8Xl01hDiRp5f7Py93CeD40=", + "lastModified": 1619532520, + "narHash": "sha256-+xIFAW5J0AcxwAflAX1gg/C8kfaqeZbS4XAZusCrZPY=", "owner": "gytis-ivaskevicius", "repo": "flake-utils-plus", - "rev": "be032a4396ad4cd7ea9bb733db8e456ec339ac9c", + "rev": "8eb7f9206713a528174c20c5133521dc37e2bfb1", "type": "github" }, "original": { diff --git a/lib/mkFlake/default.nix b/lib/mkFlake/default.nix index bcab7a13..7b12cf41 100644 --- a/lib/mkFlake/default.nix +++ b/lib/mkFlake/default.nix @@ -25,35 +25,39 @@ let }) ]; + stripChannel = channel: removeAttrs channel [ + # arguments in our channels api that shouldn't be passed to fup + "overlays" + ]; getDefaultChannel = channels: channels.${cfg.nixos.hostDefaults.channelName}; + + # evalArgs sets channelName and system to null by default + # but for proper default handling in fup, null args have to be removed + stripHost = args: removeAttrs (lib.filterAttrs (_: arg: arg != null) args) [ + # arguments in our hosts/hostDefaults api that shouldn't be passed to fup + "externalModules" + ]; + hosts = lib.mapAttrs (_: stripHost) cfg.nixos.hosts; + hostDefaults = stripHost cfg.nixos.hostDefaults; in lib.systemFlake (lib.recursiveUpdate otherArguments { - inherit self inputs; + inherit self inputs hosts; inherit (cfg) channelsConfig supportedSystems; channels = mapAttrs (name: channel: - channel // { + stripChannel (channel // { # pass channels if "overlay" has three arguments overlaysBuilder = channels: lib.unifyOverlays channels channel.overlays; - } + }) ) cfg.channels; - # the host arguments cannot exist for fup hostDefaults to work - # so evalArgs sets them to null by default and the null args are filtered out here - hosts = mapAttrs (_: host: lib.filterAttrs (_: arg: arg != null) host) cfg.nixos.hosts; - - hostDefaults = { + hostDefaults = lib.mergeAny hostDefaults { specialArgs.suites = cfg.nixos.suites; - modules = cfg.nixos.hostDefaults.modules - ++ cfg.nixos.hostDefaults.externalModules - ++ defaultModules; + modules = cfg.nixos.hostDefaults.externalModules ++ defaultModules; builder = os.devosSystem { inherit self inputs; }; - inherit (cfg.nixos.hostDefaults) - channelName - system; }; nixosModules = lib.exporter.modulesFromList cfg.nixos.hostDefaults.modules;