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