Test host specific nixpkgs
This commit is contained in:
parent
c1a2aa1d63
commit
5856edeb47
4 changed files with 106 additions and 96 deletions
45
helper.nix
45
helper.nix
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue