{ self, nixpkgs, ... }@inputs: let readHostDir = builtins.filter (name: name != "_minimal") ( builtins.attrNames (nixpkgs.lib.filterAttrs (name: type: type == "directory") ( builtins.readDir ../../config/hosts))); filterMinimal = attr: nixpkgs.lib.filterAttrs (name: v: !(nixpkgs.lib.hasSuffix "-minimal" name)) attr; genColmenaCfg = name: host: { deployment = { allowLocalDeployment = builtins.any (hostName: hostName == name) [ "ryuuko" ]; targetHost = nixpkgs.lib.findFirst (el: el != null) host.config.networking.fqdn [ host.config.kyouma.deployment.targetHost ]; targetPort = 22; # change back to null after switching ryuuko to nixos targetUser = "emily"; tags = host.config.kyouma.deployment.tags; }; imports = host._module.args.modules; nixpkgs.system = host.config.nixpkgs.system; }; genNixosCfg = { hostname, system ? "x86_64-linux" }: nixpkgs.lib.nixosSystem { system = system; specialArgs = { inherit inputs; }; modules = [ ../../config/hosts/${hostname}/configuration.nix ({ ... }: { nixpkgs.overlays = [ self.overlays.kyouma ]; nixpkgs.hostPlatform = system; }) ]; }; in { mapHosts = hostCfg: nixpkgs.lib.recursiveUpdate ( nixpkgs.lib.genAttrs readHostDir (host: { hostname = host; })) hostCfg; mapColmenaCfg = extraColmenaCfg: nixpkgs.lib.recursiveUpdate (builtins.mapAttrs (genColmenaCfg) ( filterMinimal self.nixosConfigurations)) extraColmenaCfg; mapNixosCfg = extraNixosCfg: nixpkgs.lib.recursiveUpdate (builtins.mapAttrs (name: value: genNixosCfg value) self.hosts) extraNixosCfg; }