feat(inventory): remove tag settings for now

This commit is contained in:
Johannes Kirschbauer
2025-04-01 11:04:51 +02:00
parent ae8e7edac0
commit 663739a629
2 changed files with 11 additions and 9 deletions

View File

@@ -14,7 +14,7 @@ in
}: }:
{ {
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.<attrName> # Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.<attrName>
legacyPackages.evalTest-distributedServices = import ./tests { legacyPackages.evalTests-distributedServices = import ./tests {
inherit lib self; inherit lib self;
}; };
@@ -24,7 +24,7 @@ in
nix-unit --eval-store "$HOME" \ nix-unit --eval-store "$HOME" \
--extra-experimental-features flakes \ --extra-experimental-features flakes \
${inputOverrides} \ ${inputOverrides} \
--flake ${self}#legacyPackages.${system}.evalTest-distributedServices --flake ${self}#legacyPackages.${system}.evalTests-distributedServices
touch $out touch $out
''; '';

View File

@@ -54,7 +54,7 @@ let
) [ ] members.tags or [ ]); ) [ ] members.tags or [ ]);
}; };
machineHasTag = machineName: tagName: lib.elem tagName inventory.machines.${machineName}.tags; # machineHasTag = machineName: tagName: lib.elem tagName inventory.machines.${machineName}.tags;
# map the instances into the module # map the instances into the module
importedModuleWithInstances = lib.mapAttrs ( importedModuleWithInstances = lib.mapAttrs (
@@ -119,9 +119,12 @@ let
machineName: machineName:
let let
machineSettings = instance.roles.${roleName}.machines.${machineName}.settings or { }; machineSettings = instance.roles.${roleName}.machines.${machineName}.settings or { };
settingsViaTags = lib.filterAttrs ( # TODO: tag settings
tagName: _: machineHasTag machineName tagName # Wait for this feature until option introspection for 'settings' is done.
) instance.roles.${roleName}.tags; # This might get too complex to handle otherwise.
# settingsViaTags = lib.filterAttrs (
# tagName: _: machineHasTag machineName tagName
# ) instance.roles.${roleName}.tags;
in in
{ {
# TODO: Do we want to wrap settings with # TODO: Do we want to wrap settings with
@@ -129,7 +132,7 @@ let
settings = { settings = {
imports = [ imports = [
machineSettings machineSettings
] ++ lib.attrValues (lib.mapAttrs (_tagName: v: v.settings) settingsViaTags); ]; # ++ lib.attrValues (lib.mapAttrs (_tagName: v: v.settings) settingsViaTags);
}; };
} }
); );
@@ -194,6 +197,5 @@ let
) { } evals; ) { } evals;
in in
{ {
inherit importedModuleWithInstances grouped; inherit importedModuleWithInstances grouped evals allMachines;
inherit evals allMachines;
} }