32 lines
928 B
Nix
32 lines
928 B
Nix
{ nixpkgs, ... }:
|
|
{
|
|
generateColmenaHost = name: {
|
|
site,
|
|
modules,
|
|
...
|
|
}: {
|
|
deployment = {
|
|
targetHost = "${name}.${site}.grzb.de";
|
|
targetUser = "colmena-deploy";
|
|
};
|
|
|
|
# Set imports and optionally import colmena secrets configuration
|
|
imports = modules ++ nixpkgs.lib.optional (builtins.pathExists ./hosts/${name}/secrets.nix) ./hosts/${name}/secrets.nix;
|
|
};
|
|
|
|
generateNixConfiguration = name: {
|
|
hostNixpkgs,
|
|
system,
|
|
modules,
|
|
...
|
|
}:
|
|
let
|
|
# Filter attritubes starting with _ to avoid infinite recursion when building with hydra
|
|
# TODO: Why does this happen?
|
|
filter = name: host: (builtins.substring 0 1 name) != "_";
|
|
in
|
|
(nixpkgs.lib.filterAttrs filter (hostNixpkgs.lib.nixosSystem {
|
|
inherit system modules;
|
|
})).config.system.build.toplevel; # Builds the entire NixOS system, see: https://nixos.org/manual/nixos/stable/#sec-building-parts
|
|
}
|