diff --git a/flake.nix b/flake.nix index 180fdac..7cef0da 100644 --- a/flake.nix +++ b/flake.nix @@ -105,6 +105,13 @@ }; }; + # nix eval .#domains --json + domains = inputs.self.lib.getDomainsPerHost [ + "gospel" + "node" + "pi4" + ] inputs.self.nixosConfigurations; + # TODO: Re-enable this when I figure out how to prevent needing to build # dependencies for architectures other than the host machine # checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib; diff --git a/lib/helpers/default.nix b/lib/helpers/default.nix new file mode 100644 index 0000000..0fa0426 --- /dev/null +++ b/lib/helpers/default.nix @@ -0,0 +1,13 @@ +{ + lib, + ... +}: +rec { + getValues = keys: attrs: lib.attrsets.filterAttrs (name: value: builtins.elem name keys) attrs; + + getDomainNames = + cfgs: + lib.attrsets.mapAttrs (name: cfg: builtins.attrNames cfg.config.services.nginx.virtualHosts) cfgs; + + getDomainsPerHost = systemNames: nixosConfigs: getDomainNames (getValues systemNames nixosConfigs); +}