Inventory: only apply if settings.json exists

This commit is contained in:
Johannes Kirschbauer
2024-07-15 19:14:23 +02:00
parent a76221da33
commit 914d50a1c5
2 changed files with 16 additions and 10 deletions

View File

@@ -78,7 +78,9 @@ let
# Will be deprecated # Will be deprecated
{ {
machines = lib.mapAttrs ( machines =
lib.mapAttrs
(
name: _: name: _:
# Use mkForce to make sure users migrate to the inventory system. # Use mkForce to make sure users migrate to the inventory system.
# When the settings.json exists the evaluation will print the deprecation warning. # When the settings.json exists the evaluation will print the deprecation warning.
@@ -86,7 +88,12 @@ let
inherit name; inherit name;
system = (machineSettings name).nixpkgs.hostSystem or null; system = (machineSettings name).nixpkgs.hostSystem or null;
} }
) machinesDirs; )
(
lib.filterAttrs (
machineName: _: builtins.pathExists "${directory}/machines/${machineName}/settings.json"
) machinesDirs
);
} }
# Deprecated interface # Deprecated interface

View File

@@ -99,7 +99,6 @@
*/ */
# clan.core.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id; # clan.core.networking.zerotier.networkId = builtins.readFile ../jon/facts/zerotier-network-id;
}; };
}; };
}; };
perSystem = perSystem =