Test host specific nixpkgs
This commit is contained in:
parent
c1a2aa1d63
commit
5856edeb47
4 changed files with 106 additions and 96 deletions
85
flake.nix
85
flake.nix
|
@ -1,90 +1,35 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
|
||||
nixos-generators = {
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nixos-generators, ... }@inputs: let
|
||||
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-generators, ... }@inputs: let
|
||||
hosts = import ./hosts.nix inputs;
|
||||
helper = (import ./helper.nix) inputs;
|
||||
in {
|
||||
hosts = {
|
||||
hydra = {
|
||||
site = "vs";
|
||||
};
|
||||
iperf = {
|
||||
site = "vs";
|
||||
};
|
||||
jackett = {
|
||||
site = "vs";
|
||||
};
|
||||
nitter = {
|
||||
site = "vs";
|
||||
};
|
||||
nixos-coturn = {
|
||||
site = "vs";
|
||||
};
|
||||
tor-relay = {
|
||||
site = "vs";
|
||||
};
|
||||
web-public-2 = {
|
||||
site = "vs";
|
||||
};
|
||||
};
|
||||
|
||||
generateColmenaHost = name: host: {
|
||||
deployment = {
|
||||
targetHost = "${name}.${host.site}.grzb.de";
|
||||
targetUser = "colmena-deploy";
|
||||
};
|
||||
|
||||
imports = [
|
||||
./configuration/common
|
||||
./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 = {
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs {
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
# Set the default pkgs, which is pointless in this case,
|
||||
# because nodeNixpkgs is overriding it anyway and a default value is generated.
|
||||
# It is still needed for colmena to run.
|
||||
nixpkgs = nixpkgs.legacyPackages."x86_64-linux";
|
||||
|
||||
# Specify nixpkgs to use for each host.
|
||||
# The default is "nixpkgs" for "x86_64-linux" systems,
|
||||
# but it is overridden by the host-specific "hostNixpkgs" and "system" attributes.
|
||||
nodeNixpkgs = builtins.mapAttrs (name: host: host.pkgs) hosts;
|
||||
};
|
||||
} // builtins.mapAttrs (self.generateColmenaHost) self.hosts;
|
||||
|
||||
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 = [
|
||||
#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"]);
|
||||
} // builtins.mapAttrs (helper.generateColmenaHost) hosts;
|
||||
|
||||
hydraJobs = {
|
||||
nixosConfigurations = nixpkgs.lib.mapAttrs (_: config: config.config.system.build.toplevel) self.outputs.nixosConfigurations;
|
||||
nixConfigurations = builtins.mapAttrs (helper.generateNixConfiguration) hosts;
|
||||
};
|
||||
|
||||
/*
|
||||
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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue