2024-06-23 04:41:53 +00:00
|
|
|
{
|
|
|
|
description = "Bagel cooking infrastructure";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
2024-08-12 22:38:51 +00:00
|
|
|
|
2024-07-02 09:08:19 +00:00
|
|
|
terranix.url = "github:terranix/terranix";
|
2024-08-12 22:38:51 +00:00
|
|
|
terranix.inputs.nixpkgs.follows = "nixpkgs";
|
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
|
|
|
|
2024-08-03 16:40:25 +00:00
|
|
|
hydra.url = "git+https://git.lix.systems/the-distro/hydra.git";
|
2024-06-24 14:45:59 +00:00
|
|
|
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-24 06:44:25 +00:00
|
|
|
buildbot-nix.url = "git+https://git.lix.systems/lix-project/buildbot-nix.git?ref=refs/heads/non-flakes";
|
2024-07-17 12:47:38 +00:00
|
|
|
buildbot-nix.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
|
2024-07-21 15:03:29 +00:00
|
|
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
forEachSystem = f: builtins.listToAttrs (map (system: {
|
|
|
|
name = system;
|
|
|
|
value = f system;
|
|
|
|
}) supportedSystems);
|
|
|
|
systemBits = forEachSystem (system: rec {
|
2024-07-02 09:08:19 +00:00
|
|
|
inherit system;
|
2024-07-21 15:03:29 +00:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
localSystem = system;
|
|
|
|
overlays = [
|
|
|
|
inputs.hydra.overlays.default
|
|
|
|
inputs.lix.overlays.default
|
|
|
|
inputs.nix-gerrit.overlays.default
|
|
|
|
];
|
|
|
|
};
|
|
|
|
terraform = pkgs.opentofu;
|
|
|
|
terraformCfg = terranix.lib.terranixConfiguration {
|
|
|
|
inherit system;
|
|
|
|
modules = [
|
|
|
|
./terraform
|
|
|
|
{
|
|
|
|
bagel.gandi.enable = true;
|
|
|
|
bagel.hydra.enable = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
|
|
|
forEachSystem' = f: forEachSystem (system: (f systemBits.${system}));
|
|
|
|
inherit (nixpkgs) lib;
|
2024-07-02 09:08:19 +00:00
|
|
|
in
|
|
|
|
{
|
2024-07-21 15:03:29 +00:00
|
|
|
apps = forEachSystem' ({ system, pkgs, terraformCfg, terraform, ... }: {
|
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-21 15:03:29 +00:00
|
|
|
});
|
2024-07-05 09:43:53 +00:00
|
|
|
|
2024-07-21 15:03:29 +00:00
|
|
|
devShells = forEachSystem' ({ system, pkgs, ... }: {
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
packages = [
|
|
|
|
inputs.agenix.packages.${system}.agenix
|
2024-07-04 11:54:50 +00:00
|
|
|
|
2024-07-21 15:03:29 +00:00
|
|
|
pkgs.opentofu
|
2024-07-23 22:21:00 +00:00
|
|
|
|
2024-07-21 15:03:29 +00:00
|
|
|
(pkgs.callPackage ./lib/colmena-wrapper.nix { })
|
|
|
|
];
|
|
|
|
};
|
|
|
|
});
|
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
|
2024-07-17 12:47:38 +00:00
|
|
|
inputs.buildbot-nix.nixosModules.buildbot-coordinator
|
|
|
|
inputs.buildbot-nix.nixosModules.buildbot-worker
|
2024-07-10 12:24:47 +00:00
|
|
|
|
|
|
|
./services
|
|
|
|
./common
|
|
|
|
];
|
|
|
|
|
|
|
|
makeBuilder = i: lib.nameValuePair "builder-${toString i}" {
|
|
|
|
imports = commonModules;
|
2024-08-01 20:16:48 +00:00
|
|
|
bagel.baremetal.builders = { enable = true; num = i; netboot = i >= 6; };
|
2024-07-10 12:24:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
builders = lib.listToAttrs (lib.genList makeBuilder 12);
|
|
|
|
in {
|
2024-07-21 15:03:29 +00:00
|
|
|
meta.nixpkgs = systemBits.x86_64-linux.pkgs;
|
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 ];
|
2024-07-17 12:47:52 +00:00
|
|
|
buildbot.imports = commonModules ++ [ ./hosts/buildbot ];
|
2024-07-25 18:46:20 +00:00
|
|
|
public01.imports = commonModules ++ [ ./hosts/public01 ];
|
2024-07-10 12:24:47 +00:00
|
|
|
} // builders;
|
2024-07-10 16:40:59 +00:00
|
|
|
|
2024-08-01 20:47:25 +00:00
|
|
|
hydraJobs = builtins.mapAttrs (n: v: v.config.system.build.netbootDir or v.config.system.build.toplevel) self.nixosConfigurations;
|
2024-07-18 10:18:12 +00:00
|
|
|
buildbotJobs = builtins.mapAttrs (_: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
|
|
|
}
|