2024-06-23 04:41:53 +00:00
|
|
|
{
|
|
|
|
description = "Bagel cooking infrastructure";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2024-07-02 09:08:19 +00:00
|
|
|
terranix.url = "github:terranix/terranix";
|
2024-06-23 04:41:53 +00:00
|
|
|
|
2024-06-24 16:03:07 +00:00
|
|
|
agenix.url = "github:ryantm/agenix";
|
|
|
|
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2024-06-23 04:41:53 +00:00
|
|
|
colmena.url = "github:zhaofengli/colmena";
|
|
|
|
colmena.inputs.nixpkgs.follows = "nixpkgs";
|
2024-06-24 14:45:59 +00:00
|
|
|
|
|
|
|
hydra.url = "git+https://git.lix.systems/lix-project/hydra.git";
|
|
|
|
hydra.inputs.nixpkgs.follows = "nixpkgs";
|
2024-06-24 18:59:37 +00:00
|
|
|
|
2024-07-08 20:30:08 +00:00
|
|
|
nix-gerrit.url = "git+https://git.lix.systems/the-distro/nix-gerrit.git";
|
|
|
|
nix-gerrit.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
2024-07-17 11:10:53 +00:00
|
|
|
lix.follows = "hydra/lix";
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
|
|
|
|
2024-07-09 08:49:29 +00:00
|
|
|
outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs:
|
2024-07-02 09:08:19 +00:00
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
localSystem = system;
|
|
|
|
overlays = [
|
|
|
|
inputs.hydra.overlays.default
|
|
|
|
inputs.lix.overlays.default
|
2024-07-08 20:30:08 +00:00
|
|
|
inputs.nix-gerrit.overlays.default
|
2024-07-02 09:08:19 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
lib = pkgs.lib;
|
|
|
|
terraform = pkgs.opentofu;
|
|
|
|
terraformCfg = terranix.lib.terranixConfiguration {
|
|
|
|
inherit system;
|
2024-07-07 18:43:05 +00:00
|
|
|
modules = [
|
2024-07-04 11:54:50 +00:00
|
|
|
./terraform
|
|
|
|
{
|
2024-07-07 18:43:05 +00:00
|
|
|
bagel.gandi.enable = true;
|
2024-07-04 11:54:50 +00:00
|
|
|
bagel.hydra.enable = true;
|
|
|
|
}
|
|
|
|
];
|
2024-07-02 09:08:19 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
apps.${system} = {
|
2024-07-07 17:17:11 +00:00
|
|
|
tf = {
|
2024-07-02 09:08:19 +00:00
|
|
|
type = "app";
|
2024-07-07 17:17:11 +00:00
|
|
|
program = toString (pkgs.writers.writeBash "tf" ''
|
2024-07-02 09:08:19 +00:00
|
|
|
set -eo pipefail
|
2024-07-07 17:17:11 +00:00
|
|
|
ln -snf ${terraformCfg} config.tf.json
|
|
|
|
exec ${lib.getExe terraform} "$@"
|
2024-07-02 09:08:19 +00:00
|
|
|
'');
|
2024-07-07 17:17:11 +00:00
|
|
|
};
|
2024-07-07 16:02:55 +00:00
|
|
|
|
2024-07-07 17:17:11 +00:00
|
|
|
default = self.apps.${system}.tf;
|
2024-07-02 09:08:19 +00:00
|
|
|
};
|
2024-07-05 09:43:53 +00:00
|
|
|
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
2024-07-04 11:54:50 +00:00
|
|
|
packages = [
|
2024-07-05 09:43:53 +00:00
|
|
|
inputs.agenix.packages.${system}.agenix
|
2024-07-04 11:54:50 +00:00
|
|
|
|
2024-07-12 17:00:55 +00:00
|
|
|
pkgs.colmena
|
2024-07-04 11:54:50 +00:00
|
|
|
pkgs.opentofu
|
2024-07-05 09:43:53 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-07-09 08:49:29 +00:00
|
|
|
nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes;
|
|
|
|
|
2024-07-10 12:24:47 +00:00
|
|
|
colmena = let
|
|
|
|
commonModules = [
|
|
|
|
inputs.agenix.nixosModules.default
|
|
|
|
inputs.hydra.nixosModules.hydra
|
|
|
|
|
|
|
|
./services
|
|
|
|
./common
|
|
|
|
];
|
|
|
|
|
|
|
|
makeBuilder = i: lib.nameValuePair "builder-${toString i}" {
|
|
|
|
imports = commonModules;
|
|
|
|
bagel.baremetal.builders = { enable = true; num = i; };
|
|
|
|
};
|
|
|
|
|
|
|
|
builders = lib.listToAttrs (lib.genList makeBuilder 12);
|
|
|
|
in {
|
2024-06-23 04:41:53 +00:00
|
|
|
meta.nixpkgs = import nixpkgs {
|
2024-07-02 09:08:19 +00:00
|
|
|
localSystem = system;
|
2024-06-24 18:59:37 +00:00
|
|
|
overlays = [
|
|
|
|
inputs.hydra.overlays.default
|
|
|
|
inputs.lix.overlays.default
|
2024-07-08 20:30:08 +00:00
|
|
|
inputs.nix-gerrit.overlays.default
|
2024-06-24 18:59:37 +00:00
|
|
|
];
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
2024-06-24 14:45:59 +00:00
|
|
|
meta.specialArgs.inputs = inputs;
|
|
|
|
|
2024-07-10 12:24:47 +00:00
|
|
|
bagel-box.imports = commonModules ++ [ ./hosts/bagel-box ];
|
|
|
|
meta01.imports = commonModules ++ [ ./hosts/meta01 ];
|
|
|
|
gerrit01.imports = commonModules ++ [ ./hosts/gerrit01 ];
|
|
|
|
fodwatch.imports = commonModules ++ [ ./hosts/fodwatch ];
|
2024-07-16 13:42:10 +00:00
|
|
|
git.imports = commonModules ++ [ ./hosts/git ];
|
2024-07-10 12:24:47 +00:00
|
|
|
wob-vpn-gw.imports = commonModules ++ [ ./hosts/wob-vpn-gw ];
|
|
|
|
} // builders;
|
2024-07-10 16:40:59 +00:00
|
|
|
|
2024-07-10 17:03:18 +00:00
|
|
|
hydraJobs = builtins.mapAttrs (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
|
|
|
}
|