make devosSystem construct a proper nixos builder

Get `self` and `inputs` during construction, and rely on
specialArgs.channel for nixos flake
This commit is contained in:
Pacman99 2021-04-25 16:21:40 -07:00
parent c0d6453b08
commit abd133c244

View file

@ -1,31 +1,40 @@
{ lib }: { lib }:
{ self, nixos, inputs, modules, ... } @ allArgs: # dependencies to return a builder
let args = builtins.removeAttrs allArgs [ "self" "nixos" "inputs" ]; in { self, inputs }:
lib.nixosSystem (args // {
modules =
let
moduleList = builtins.attrValues modules;
fullHostConfig = (lib.nixosSystem (args // { modules = moduleList; })).config; { modules, specialArgs, ... } @ args:
let inherit (specialArgs.channel.input.lib) nixosSystem; in
nixosSystem
(args // {
modules =
let
fullHostConfig = (nixosSystem (args // { inherit modules; })).config;
isoConfig = (lib.nixosSystem isoConfig = (nixosSystem
(args // { (args // {
modules = moduleList ++ [ modules = modules ++ [
(lib.modules.iso { inherit self nixos inputs fullHostConfig; }) (lib.modules.iso { inherit self inputs fullHostConfig; })
]; ];
})).config; })).config;
hmConfig = (lib.nixosSystem
(args // { hmConfig = (nixosSystem
modules = moduleList ++ [ (args // {
(lib.modules.hmConfig) modules = modules ++ [
]; (lib.modules.hmConfig)
})).config; ];
in })).config;
moduleList ++ [{ in
system.build = { modules ++ [{
iso = isoConfig.system.build.isoImage; system.build = {
homes = hmConfig.home-manager.users; iso = isoConfig.system.build.isoImage;
}; homes = hmConfig.home-manager.users;
}]; };
}) lib = {
inherit specialArgs;
testModule = {
imports = modules;
};
};
}];
})