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
|
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-generators, ... }@inputs: let
|
||||||
hosts = import ./hosts.nix inputs;
|
hosts = import ./hosts.nix inputs;
|
||||||
helper = (import ./helper.nix) inputs;
|
helper = import ./helper.nix inputs;
|
||||||
in {
|
in {
|
||||||
colmena = {
|
colmena = {
|
||||||
meta = {
|
meta = {
|
||||||
|
|
13
helper.nix
13
helper.nix
|
@ -19,8 +19,13 @@
|
||||||
system,
|
system,
|
||||||
modules,
|
modules,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
(nixpkgs.lib.filterAttrs (name: host: (builtins.substring 0 1 name) != "_") (hostNixpkgs.lib.nixosSystem {
|
let
|
||||||
inherit system modules;
|
# Filter attritubes starting with _ to avoid infinite recursion when building with hydra
|
||||||
})).config.system.build.toplevel;
|
# 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, ... }:
|
{ nixpkgs, nixpkgs-unstable, ... }:
|
||||||
let
|
let
|
||||||
|
# Set of environment specific modules
|
||||||
environments = {
|
environments = {
|
||||||
"proxmox" = [
|
"proxmox" = [
|
||||||
./configuration/proxmox-vm
|
./configuration/proxmox-vm
|
||||||
./configuration/proxmox-vm/hardware-configuration.nix
|
./configuration/proxmox-vm/hardware-configuration.nix
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
#
|
||||||
generateDefaults = hosts: builtins.mapAttrs (name: {
|
generateDefaults = hosts: builtins.mapAttrs (name: {
|
||||||
hostNixpkgs ? nixpkgs,
|
hostNixpkgs ? nixpkgs,
|
||||||
system ? "x86_64-linux",
|
system ? "x86_64-linux",
|
||||||
|
# pkgs is explicitly defined so that overlays for each host can easily be created
|
||||||
pkgs ? hostNixpkgs.legacyPackages.${system},
|
pkgs ? hostNixpkgs.legacyPackages.${system},
|
||||||
environment ? "proxmox",
|
environment ? "proxmox",
|
||||||
site
|
site
|
||||||
}: {
|
}: {
|
||||||
inherit hostNixpkgs system pkgs environment site;
|
inherit hostNixpkgs system pkgs environment site;
|
||||||
|
# define common and host modules and additionally add environment specific modules
|
||||||
modules = [
|
modules = [
|
||||||
./configuration/common
|
./configuration/common
|
||||||
./hosts/${name}
|
./hosts/${name}
|
||||||
] ++ (if environments ? ${environment} then environments.${environment} else []);
|
] ++ environments.${environment};
|
||||||
}) hosts;
|
}) hosts;
|
||||||
in
|
in
|
||||||
generateDefaults {
|
generateDefaults {
|
||||||
|
|
Loading…
Reference in a new issue