project-wide: A move to targets, getting closer to production

This commit is contained in:
kat witch 2021-03-31 00:01:03 +01:00
parent bcfdc68b30
commit 1ce1328695
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
16 changed files with 150 additions and 110 deletions

View file

@ -9,7 +9,7 @@ rec {
hostConfig = hostName:
{ config, ... }: {
_module.args = { inherit hosts groups; };
_module.args = { inherit hosts targets; };
imports = [ ../nixos.nix ../modules/nixos ];
networking = { inherit hostName; };
nixpkgs.pkgs = import pkgsPath {
@ -30,11 +30,6 @@ rec {
specialArgs = { inherit sources tf profiles witch hostName; };
})) hostNames);
groupNames = unique (concatLists
(mapAttrsToList (name: host: host.config.deploy.groups) hosts));
groups = listToAttrs (map (groupName:
nameValuePair groupName (attrNames
(filterAttrs (name: host: elem groupName host.config.deploy.groups)
hosts))) groupNames);
targets = foldAttrs (host: hosts: [ host ] ++ hosts) [ ] (mapAttrsToList
(hostName: host: { ${host.config.deploy.target} = hostName; }) hosts);
}