nix-infra/flake.nix

79 lines
2.7 KiB
Nix
Raw Normal View History

2023-07-10 15:30:51 +02:00
{
inputs = {
2024-07-01 15:57:16 +02:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05-small";
2023-07-30 01:38:31 +02:00
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2024-03-08 00:28:42 +01:00
nixpkgs-master.url = "github:NixOS/nixpkgs/master";
2023-07-26 01:09:38 +02:00
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
2024-07-01 15:57:16 +02:00
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
2023-07-10 15:30:51 +02:00
};
2024-08-12 20:14:13 +02:00
outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-master, 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 = {
2024-08-12 20:14:13 +02:00
inherit nixpkgs-unstable nixpkgs-master hosts simple-nixos-mailserver;
# Provide environment for secret key command
keyCommandEnv = [ "env" "GNUPGHOME=/home/yuri/.passinfra_gnupg" "PASSWORD_STORE_DIR=/home/yuri/pass/infra" ];
};
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 = {
nixConfigurations = builtins.mapAttrs (host: helper.generateNixConfiguration host {
2024-08-12 20:14:13 +02:00
inherit nixpkgs-unstable nixpkgs-master 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
};
}