diff --git a/src/dotfiles/default.nix b/src/dotfiles/default.nix index 5c72daf..245364c 100644 --- a/src/dotfiles/default.nix +++ b/src/dotfiles/default.nix @@ -5,19 +5,6 @@ root, }: let - registry = import ./registry.nix { - inherit lib; - hosts = self.nixosConfigurations; - root = root + "/registry"; - }; - - modules = import ./modules.nix { - inherit util; - root = root + "/modules"; - }; - - util = import ./util.nix { inherit lib; }; - specialArgs = { inherit inputs @@ -27,6 +14,14 @@ let registry = registry.collected; }; + util = import ./util.nix { inherit lib; }; + + registry = import ./registry.nix { + inherit lib; + hosts = self.nixosConfigurations; + root = root + "/registry"; + }; + guestModules = import ./guests.nix { inherit inputs @@ -38,6 +33,11 @@ let repositoryModules = modules; root = root + "/guests"; }; + modules = import ./modules.nix { + inherit util; + root = root + "/modules"; + }; + in { nixosConfigurations = import ./hosts.nix { diff --git a/src/dotfiles/registry.nix b/src/dotfiles/registry.nix index a7331f3..8d6c2e0 100644 --- a/src/dotfiles/registry.nix +++ b/src/dotfiles/registry.nix @@ -34,6 +34,17 @@ let inherit (evaluated.config) type replicate checks; }; + registryLib = lib // { + registry = (lib.registry or { }) // { + inherit predicates; + }; + }; + + predicates = { + uniqueValue = + value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries; + }; + registryDefinitionModule = { options = { type = lib.mkOption { @@ -79,6 +90,15 @@ let }; }; + registryOption = + registry: + lib.mkOption { + type = lib.types.attrsOf (lib.types.attrsOf registry.type); + default = { }; + description = '' + Lazily collected fleet-visible registry entries, nested by host and entry name. + ''; + }; withOperations = registry: registry @@ -188,27 +208,6 @@ let ) data ); - predicates = { - uniqueValue = - value: entries: builtins.length (lib.unique (map value entries)) == builtins.length entries; - }; - - registryLib = lib // { - registry = (lib.registry or { }) // { - inherit predicates; - }; - }; - - registryOption = - registry: - lib.mkOption { - type = lib.types.attrsOf (lib.types.attrsOf registry.type); - default = { }; - description = '' - Lazily collected fleet-visible registry entries, nested by host and entry name. - ''; - }; - in { types = lib.mapAttrs (_name: definition: definition.type) definitions;