nix-infra/flake.nix
2023-11-09 23:10:52 +01:00

57 lines
1.8 KiB
Nix

{
inputs = {
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, nixpkgs-unstable, nixos-generators, ... }@inputs: let
hosts = import ./hosts.nix inputs;
helper = import ./helper.nix inputs;
in {
colmena = {
meta = {
# 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 (helper.generateColmenaHost) hosts;
hydraJobs = {
nixConfigurations = builtins.mapAttrs (helper.generateNixConfiguration) hosts;
};
# Generate a base VM image for Proxmox with `nix build .#base-proxmox`
packages.x86_64-linux = {
base-proxmox = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./configuration/common
./configuration/nixos-generators
./configuration/proxmox-vm
];
format = "proxmox";
};
};
# Binary cache hint
nixConfig = {
extra-substituters = [
"https://nix-cache.nekover.se"
];
extra-trusted-public-keys = [
"nix-cache.nekover.se:f/VfGqC5lctLzOa6pLLDmEkihcip4WYpYShlW3rivLU="
];
};
};
}