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