2023-07-30 01:38:31 +02:00
|
|
|
{ nixpkgs, ... }:
|
|
|
|
{
|
|
|
|
generateColmenaHost = name: {
|
|
|
|
site,
|
|
|
|
modules,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
deployment = {
|
|
|
|
targetHost = "${name}.${site}.grzb.de";
|
|
|
|
targetUser = "colmena-deploy";
|
|
|
|
};
|
2023-07-27 21:59:24 +02:00
|
|
|
|
2023-07-30 01:38:31 +02:00
|
|
|
# Set imports and optionally import colmena secrets configuration
|
2023-09-14 14:43:49 +02:00
|
|
|
imports = modules ++ nixpkgs.lib.optional (builtins.pathExists ./config/hosts/${name}/secrets.nix) ./config/hosts/${name}/secrets.nix;
|
2023-07-30 01:38:31 +02:00
|
|
|
};
|
2023-07-27 21:59:24 +02:00
|
|
|
|
2023-08-07 00:58:45 +02:00
|
|
|
generateNixConfiguration = name: specialArgs: {
|
2023-07-30 01:38:31 +02:00
|
|
|
hostNixpkgs,
|
|
|
|
system,
|
|
|
|
modules,
|
|
|
|
...
|
2023-07-31 15:03:52 +02:00
|
|
|
}:
|
|
|
|
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 {
|
2023-08-07 00:58:45 +02:00
|
|
|
inherit system modules specialArgs;
|
2023-07-31 15:03:52 +02:00
|
|
|
})).config.system.build.toplevel; # Builds the entire NixOS system, see: https://nixos.org/manual/nixos/stable/#sec-building-parts
|
2023-07-27 21:59:24 +02:00
|
|
|
}
|