feat(lib): add stable service uid registry

This commit was merged in pull request #45.
This commit is contained in:
2026-08-16 14:42:16 -04:00
parent 14da6e5c2e
commit acdc497e4c
5 changed files with 88 additions and 12 deletions

View File

@@ -98,13 +98,25 @@
];
};
# `nix flake check` builds each host's toplevel.
checks.x86_64-linux = lib.mapAttrs (
name: host:
if host.config.warnings == [] then
host.config.system.build.toplevel
else
throw "Host ${name} has evaluation warnings:\n${lib.concatStringsSep "\n" host.config.warnings}"
) self.nixosConfigurations;
# `nix flake check` builds host toplevels and project-level checks.
checks.x86_64-linux =
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
serviceIdentities = import ./lib/service-identities.nix { inherit lib; };
serviceIdentityTestsPass = lib.all (result: result) (lib.attrValues serviceIdentities.tests);
in
(lib.mapAttrs (
name: host:
if host.config.warnings == [] then
host.config.system.build.toplevel
else
throw "Host ${name} has evaluation warnings:\n${lib.concatStringsSep "\n" host.config.warnings}"
) self.nixosConfigurations)
// {
service-identities = pkgs.runCommand "service-identities-check" { } ''
${lib.optionalString (!serviceIdentityTestsPass) "exit 1"}
touch $out
'';
};
};
}