mirror of
https://github.com/divnix/digga.git
synced 2024-12-25 17:14:38 +03:00
2d9ea0d27e
This helps to split up the code in mkHosts and creates a place where we can store modules relevent to devos. It will also be easier to remove unecessary parts of each module in the future when they are all compartmentalized.
58 lines
1.3 KiB
Nix
58 lines
1.3 KiB
Nix
{ 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 ]);
|
|
};
|
|
|
|
lib = { inherit specialArgs; };
|
|
lib.testModule = {
|
|
imports = builtins.attrValues modules;
|
|
};
|
|
|
|
};
|
|
in
|
|
lib.os.devosSystem {
|
|
inherit self nixos inputs specialArgs;
|
|
system = defaultSystem;
|
|
modules = modules // { inherit local; };
|
|
};
|
|
|
|
hosts = lib.os.recImport
|
|
{
|
|
inherit dir;
|
|
_import = mkHostConfig;
|
|
};
|
|
in
|
|
hosts
|