nix/hosts/deployments.nix

46 lines
1.2 KiB
Nix

{ inputs, ... }:
let
p = import ./parameters.nix;
hosts = p.hosts;
hostDefs = import ./hosts.nix;
# Generate complete colmena host configs (imports + deployment)
mkColmenaHosts = builtins.mapAttrs (name: cfg: {
imports = inputs.self.nixosConfigurations.${name}._module.args.modules;
deployment = {
targetHost = hosts.${name} or null;
tags = cfg.tags;
}
// (if cfg ? colmenaSshPort then { targetPort = cfg.colmenaSshPort; } else { });
}) hostDefs;
in
mkColmenaHosts
// {
meta = {
nixpkgs = import inputs.nixpkgs {
system = "x86_64-linux";
overlays = [ ];
config.allowUnfree = true;
};
nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) inputs.self.nixosConfigurations;
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs) inputs.self.nixosConfigurations;
};
# Special hosts not defined in hosts.nix
baseLXC = {
imports = inputs.self.nixosConfigurations.baseLXC._module.args.modules;
deployment = {
targetHost = null;
tags = [ "template" ];
};
};
deadbeef = {
deployment = {
allowLocalDeployment = true;
targetHost = null;
tags = [ "local" ];
};
};
}