Generate hosts for hydra
This commit is contained in:
parent
10de1e428a
commit
c1a2aa1d63
5 changed files with 61 additions and 18 deletions
44
flake.nix
44
flake.nix
|
@ -1,13 +1,15 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
nixos-generators = {
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-generators, ... }: {
|
||||
outputs = { self, nixpkgs, nixos-generators, ... }@inputs: let
|
||||
helper = (import ./helper.nix) inputs;
|
||||
in {
|
||||
hosts = {
|
||||
hydra = {
|
||||
site = "vs";
|
||||
|
@ -32,7 +34,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
generateColmenaHost = name: host : {
|
||||
generateColmenaHost = name: host: {
|
||||
deployment = {
|
||||
targetHost = "${name}.${host.site}.grzb.de";
|
||||
targetUser = "colmena-deploy";
|
||||
|
@ -43,7 +45,7 @@
|
|||
./configuration/proxmox-vm
|
||||
./configuration/proxmox-vm/hardware-configuration.nix
|
||||
./hosts/${name}
|
||||
];
|
||||
] ++ nixpkgs.lib.optional (builtins.pathExists ./hosts/${name}/secrets.nix) ./hosts/${name}/secrets.nix;
|
||||
};
|
||||
|
||||
colmena = {
|
||||
|
@ -54,18 +56,35 @@
|
|||
};
|
||||
} // builtins.mapAttrs (self.generateColmenaHost) self.hosts;
|
||||
|
||||
hydraJobs = {
|
||||
nixConfigurations.nitter = let system = "x86_64-linux";
|
||||
in nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
nixosConfigurations = nixpkgs.lib.mapAttrs (name: config: let
|
||||
nodeNixpkgs = self.outputs.colmena.meta.nodeNixpkgs.${name} or self.outputs.colmena.meta.nixpkgs;
|
||||
nodeNixos = import (nodeNixpkgs.path + "/nixos/lib/eval-config.nix");
|
||||
in nodeNixos {
|
||||
modules = [
|
||||
./configuration/common
|
||||
./configuration/proxmox-vm
|
||||
./hosts/nitter
|
||||
#self.outputs.colmena.defaults
|
||||
config
|
||||
#inputs.colmena.nixosModules.deploymentOptions
|
||||
{
|
||||
_module.args.name = nixpkgs.lib.mkForce name;
|
||||
_module.args.nodes = self.outputs.nixosConfigurations;
|
||||
#nixpkgs.overlays = nixpkgs.lib.attrValues self.overlays;
|
||||
}
|
||||
];
|
||||
};
|
||||
inherit (nodeNixpkgs) system;
|
||||
}
|
||||
) (builtins.removeAttrs self.outputs.colmena ["meta" "defaults"]);
|
||||
|
||||
hydraJobs = {
|
||||
nixosConfigurations = nixpkgs.lib.mapAttrs (_: config: config.config.system.build.toplevel) self.outputs.nixosConfigurations;
|
||||
};
|
||||
|
||||
/*
|
||||
nixosConfigurations = (builtins.mapAttrs (helper.mapToNixosConfigurations) self.hosts);
|
||||
hydraJobs = {
|
||||
nixConfigurations = helper.buildHosts self.nixosConfigurations;
|
||||
};
|
||||
*/
|
||||
|
||||
# Generate a base VM image for Proxmox with `nix build .#base-proxmox`
|
||||
packages.x86_64-linux = {
|
||||
base-proxmox = nixos-generators.nixosGenerate {
|
||||
|
@ -78,5 +97,6 @@
|
|||
format = "proxmox";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue