Generate colmena and hydraJobs outputs from the same hosts attribute set
This commit is contained in:
parent
5856edeb47
commit
59a7e36838
|
@ -10,7 +10,7 @@
|
|||
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-generators, ... }@inputs: let
|
||||
hosts = import ./hosts.nix inputs;
|
||||
helper = (import ./helper.nix) inputs;
|
||||
helper = import ./helper.nix inputs;
|
||||
in {
|
||||
colmena = {
|
||||
meta = {
|
||||
|
|
11
helper.nix
11
helper.nix
|
@ -20,7 +20,12 @@
|
|||
modules,
|
||||
...
|
||||
}:
|
||||
(nixpkgs.lib.filterAttrs (name: host: (builtins.substring 0 1 name) != "_") (hostNixpkgs.lib.nixosSystem {
|
||||
inherit system modules;
|
||||
})).config.system.build.toplevel;
|
||||
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
|
||||
}
|
||||
|
|
|
@ -1,23 +1,27 @@
|
|||
{ nixpkgs, nixpkgs-unstable, ... }:
|
||||
let
|
||||
# Set of environment specific modules
|
||||
environments = {
|
||||
"proxmox" = [
|
||||
./configuration/proxmox-vm
|
||||
./configuration/proxmox-vm/hardware-configuration.nix
|
||||
];
|
||||
};
|
||||
#
|
||||
generateDefaults = hosts: builtins.mapAttrs (name: {
|
||||
hostNixpkgs ? nixpkgs,
|
||||
system ? "x86_64-linux",
|
||||
# pkgs is explicitly defined so that overlays for each host can easily be created
|
||||
pkgs ? hostNixpkgs.legacyPackages.${system},
|
||||
environment ? "proxmox",
|
||||
site
|
||||
}: {
|
||||
inherit hostNixpkgs system pkgs environment site;
|
||||
# define common and host modules and additionally add environment specific modules
|
||||
modules = [
|
||||
./configuration/common
|
||||
./hosts/${name}
|
||||
] ++ (if environments ? ${environment} then environments.${environment} else []);
|
||||
] ++ environments.${environment};
|
||||
}) hosts;
|
||||
in
|
||||
generateDefaults {
|
||||
|
|
Loading…
Reference in a new issue