Test host specific nixpkgs

This commit is contained in:
fi 2023-07-30 01:38:31 +02:00
parent c1a2aa1d63
commit 5856edeb47
Signed by: fi
SSH key fingerprint: SHA256:d+6fQoDPMbSFK95zRVflRKZLRKF4cPSQb7VIxYkhFsA
4 changed files with 106 additions and 96 deletions

View file

@ -1,25 +1,26 @@
{ nixpkgs, ... }@inputs:
rec {
generateNixosSystem = name: {
system ? "x86_64-linux",
group ? null,
modules ? [],
site
}: let
localNixpkgs = nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] nixpkgs inputs;
in localNixpkgs.lib.nixosSystem {
system = system;
modules = modules ++ [
./configuration/common
./configuration/proxmox-vm
./configuration/proxmox-vm/hardware-configuration.nix
./hosts/${name}
];
{ 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;
};
mapToNixosConfigurations = name: host: generateNixosSystem name host;
filterUnderscore = hosts: (nixpkgs.lib.filterAttrs (name: host: (builtins.substring 0 1 name) != "_") hosts);
buildHosts = hosts: builtins.mapAttrs (name: host: host.config.system.build.toplevel) (filterUnderscore hosts);
generateNixConfiguration = name: {
hostNixpkgs,
system,
modules,
...
}:
(nixpkgs.lib.filterAttrs (name: host: (builtins.substring 0 1 name) != "_") (hostNixpkgs.lib.nixosSystem {
inherit system modules;
})).config.system.build.toplevel;
}