nix-infra/flake.nix

74 lines
2.4 KiB
Nix
Raw Normal View History

2023-07-10 15:30:51 +02:00
{
inputs = {
2023-07-30 01:38:31 +02:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05-small";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2023-07-26 01:09:38 +02:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-23.05";
2023-07-10 15:30:51 +02:00
};
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-generators, simple-nixos-mailserver, ... }@inputs: let
2023-07-30 01:38:31 +02:00
hosts = import ./hosts.nix inputs;
helper = import ./helper.nix inputs;
2023-07-27 21:59:24 +02:00
in {
colmena = {
meta = {
2023-07-30 01:38:31 +02:00
# 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";
2023-07-27 21:59:24 +02:00
2023-07-30 01:38:31 +02:00
# 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;
specialArgs = {
2023-09-16 20:05:33 +02:00
inherit nixpkgs-unstable hosts simple-nixos-mailserver;
};
2023-07-30 01:38:31 +02:00
};
} // builtins.mapAttrs (helper.generateColmenaHost) hosts;
2023-07-26 01:09:38 +02:00
2023-07-27 21:59:24 +02:00
hydraJobs = {
2023-09-16 20:05:33 +02:00
nixConfigurations = builtins.mapAttrs (
host: helper.generateNixConfiguration host { inherit nixpkgs-unstable hosts simple-nixos-mailserver; }
) hosts;
2023-07-27 21:59:24 +02:00
};
2023-07-26 01:09:38 +02:00
# 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 = [
./config/common
./config/nixos-generators
2023-09-16 20:05:33 +02:00
./config/nixos-generators/proxmox.nix
./config/environments/proxmox-vm
2023-07-26 01:09:38 +02:00
];
format = "proxmox";
};
2023-09-16 20:05:33 +02:00
base-openstack = nixos-generators.nixosGenerate {
system = "x86_64-linux";
modules = [
./config/common
./config/nixos-generators
./config/environments/openstack-vm
];
format = "openstack";
};
2023-07-26 01:09:38 +02:00
};
2023-07-27 21:59:24 +02:00
2023-07-31 15:38:08 +02:00
# Binary cache hint
nixConfig = {
extra-substituters = [
"https://nix-cache.nekover.se"
];
extra-trusted-public-keys = [
"nix-cache.nekover.se:f/VfGqC5lctLzOa6pLLDmEkihcip4WYpYShlW3rivLU="
];
};
2023-07-10 15:30:51 +02:00
};
}