build-inventory: replace by equivalent submodule
This commit is contained in:
@@ -21,7 +21,7 @@ let
|
||||
inherit clanLib;
|
||||
};
|
||||
modules = [
|
||||
./builder
|
||||
./builder/default.nix
|
||||
(lib.modules.importApply ./service-list-from-inputs.nix {
|
||||
inherit flakeInputs clanLib localModuleSet;
|
||||
})
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{ clanLib }:
|
||||
{
|
||||
config,
|
||||
options,
|
||||
lib,
|
||||
clanLib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
|
||||
@@ -207,7 +207,11 @@ in
|
||||
clanModules = lib.mkOption { type = lib.types.raw; };
|
||||
|
||||
# The machine 'imports' generated by the inventory per machine
|
||||
inventoryClass = lib.mkOption { type = lib.types.raw; };
|
||||
inventoryClass = lib.mkOption {
|
||||
type = types.submoduleWith {
|
||||
modules = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: remove all dependents in python, delete this option
|
||||
inventory = lib.mkOption {
|
||||
|
||||
@@ -19,8 +19,6 @@ let
|
||||
specialArgs
|
||||
;
|
||||
|
||||
inherit (clan-core.clanLib.inventory) buildInventory;
|
||||
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
@@ -43,18 +41,39 @@ let
|
||||
if pkgs != null then pkgs else nixpkgs.legacyPackages.${system}
|
||||
);
|
||||
|
||||
# map from machine name to service configuration
|
||||
# { ${machineName} :: Config }
|
||||
inventoryClass = (
|
||||
buildInventory {
|
||||
inherit inventory directory;
|
||||
flakeInputs = config.self.inputs;
|
||||
prefix = config._prefix ++ [ "inventoryClass" ];
|
||||
# TODO: remove inventory.modules, this is here for backwards compatibility
|
||||
inherit (clan-core) clanLib;
|
||||
inventoryClass =
|
||||
let
|
||||
localModuleSet =
|
||||
lib.filterAttrs (n: _: !inventory._legacyModules ? ${n}) inventory.modules // config.modules;
|
||||
flakeInputs = config.self.inputs;
|
||||
in
|
||||
{
|
||||
_module.args = {
|
||||
inherit clanLib;
|
||||
};
|
||||
imports = [
|
||||
../../inventory/build-inventory/builder/default.nix
|
||||
(lib.modules.importApply ../../inventory/build-inventory/service-list-from-inputs.nix {
|
||||
inherit localModuleSet flakeInputs clanLib;
|
||||
})
|
||||
{
|
||||
inherit inventory directory;
|
||||
}
|
||||
);
|
||||
(
|
||||
{ config, ... }:
|
||||
{
|
||||
distributedServices = clanLib.inventory.mapInstances {
|
||||
inherit (config) inventory;
|
||||
inherit localModuleSet flakeInputs;
|
||||
prefix = [ "distributedServices" ];
|
||||
};
|
||||
machines = config.distributedServices.allMachines;
|
||||
}
|
||||
)
|
||||
../../inventory/build-inventory/inventory-introspection.nix
|
||||
];
|
||||
};
|
||||
|
||||
moduleSystemConstructor = {
|
||||
# TODO: remove default system once we have a hardware-config mechanism
|
||||
|
||||
Reference in New Issue
Block a user