ark/lib/devos/mkHosts.nix

58 lines
1.3 KiB
Nix
Raw Normal View History

{ lib }:
{ self, nixos, inputs, dir, extern, suites, overrides, multiPkgs }:
let
defaultSystem = "x86_64-linux";
modules = with lib.modules; {
modOverrides = modOverrides { inherit overrides; };
hmDefaults = hmDefaults {
inherit extern;
inherit (self) homeModules;
userSuites = suites.user;
};
globalDefaults = globalDefaults {
inherit self nixos inputs multiPkgs;
};
cachix = cachix { inherit self; };
flakeModules = flakeModules { inherit self extern; };
};
specialArgs = extern.specialArgs // { suites = suites.system; };
mkHostConfig = hostName:
let
local = {
require = [
"${dir}/${hostName}.nix"
];
networking = { inherit hostName; };
_module.args = {
self = self;
hosts = builtins.mapAttrs (_: host: host.config)
(removeAttrs hosts [ hostName ]);
};
2021-04-19 07:48:19 +03:00
lib = { inherit specialArgs; };
lib.testModule = {
imports = builtins.attrValues modules;
};
2021-04-19 07:48:19 +03:00
};
in
2021-04-18 04:35:05 +03:00
lib.os.devosSystem {
inherit self nixos inputs specialArgs;
system = defaultSystem;
2021-04-19 07:48:19 +03:00
modules = modules // { inherit local; };
};
2021-04-18 04:35:05 +03:00
hosts = lib.os.recImport
{
inherit dir;
_import = mkHostConfig;
};
2020-07-31 07:17:28 +03:00
in
hosts