forked from the-distro/infra
Pierre Bourdon
234522cc3b
Flake lock file updates: • Updated input 'hydra': 'git+https://git.lix.systems/lix-project/hydra.git?ref=refs/heads/main&rev=fb9e29d4d0f2f591cd1d706fd3b7334af7d34b84' (2024-07-13) → 'git+https://git.lix.systems/lix-project/hydra.git?ref=refs/heads/main&rev=b0e9b4b2f99f9d8f5c4e780e89f955c394b5ced4' (2024-07-17) • Added input 'hydra/lix': 'git+https://git.lix.systems/lix-project/lix?ref=refs/heads/main&rev=6b4d46e9e0e1dd80e0977684ab20d14bcd1a6bc3' (2024-07-16) • Added input 'hydra/lix/flake-compat': 'github:edolstra/flake-compat/0f9255e01c2351cc7d116c072cb317785dd33b33' (2023-10-04) • Added input 'hydra/lix/nix2container': 'github:nlewo/nix2container/20aad300c925639d5d6cbe30013c8357ce9f2a2e' (2024-04-13) • Added input 'hydra/lix/nixpkgs': follows 'hydra/nixpkgs' • Added input 'hydra/lix/nixpkgs-regression': 'github:NixOS/nixpkgs/215d4d0fd80ca5163643b03a33fde804a29cc1e2' (2022-01-24) • Added input 'hydra/lix/pre-commit-hooks': 'github:cachix/git-hooks.nix/e35aed5fda3cc79f88ed7f1795021e559582093a' (2024-04-02) • Removed input 'hydra/nix' • Removed input 'hydra/nix/flake-compat' • Removed input 'hydra/nix/nix2container' • Removed input 'hydra/nix/nixpkgs' • Removed input 'hydra/nix/nixpkgs-regression' • Removed input 'hydra/nix/pre-commit-hooks' • Added input 'hydra/nix-eval-jobs': 'git+https://git.lix.systems/lix-project/nix-eval-jobs?ref=refs/heads/main&rev=c057494450f2d1420726ddb0bab145a5ff4ddfdd' (2024-07-17) • Added input 'hydra/nix-eval-jobs/flake-parts': 'github:hercules-ci/flake-parts/9227223f6d922fee3c7b190b2cc238a99527bbb7' (2024-07-03) • Added input 'hydra/nix-eval-jobs/flake-parts/nixpkgs-lib': follows 'hydra/nix-eval-jobs/nixpkgs' • Added input 'hydra/nix-eval-jobs/lix': follows 'hydra/lix' • Added input 'hydra/nix-eval-jobs/nix-github-actions': 'github:nix-community/nix-github-actions/622f829f5fe69310a866c8a6cd07e747c44ef820' (2024-07-04) • Added input 'hydra/nix-eval-jobs/nix-github-actions/nixpkgs': follows 'hydra/nix-eval-jobs/nixpkgs' • Added input 'hydra/nix-eval-jobs/nixpkgs': follows 'hydra/nixpkgs' • Added input 'hydra/nix-eval-jobs/treefmt-nix': 'github:numtide/treefmt-nix/0fb28f237f83295b4dd05e342f333b447c097398' (2024-07-15) • Added input 'hydra/nix-eval-jobs/treefmt-nix/nixpkgs': follows 'hydra/nix-eval-jobs/nixpkgs' • Updated input 'lix': follows 'hydra/nix' → follows 'hydra/lix' • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/6794d064edc69918bb0fc0e0eda33ece324be17a' (2024-07-12) → 'github:NixOS/nixpkgs/9355fa86e6f27422963132c2c9aeedb0fb963d93' (2024-07-16)
109 lines
2.9 KiB
Nix
109 lines
2.9 KiB
Nix
{
|
|
description = "Bagel cooking infrastructure";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
terranix.url = "github:terranix/terranix";
|
|
|
|
agenix.url = "github:ryantm/agenix";
|
|
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
colmena.url = "github:zhaofengli/colmena";
|
|
colmena.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
hydra.url = "git+https://git.lix.systems/lix-project/hydra.git";
|
|
hydra.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
nix-gerrit.url = "git+https://git.lix.systems/the-distro/nix-gerrit.git";
|
|
nix-gerrit.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
lix.follows = "hydra/lix";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, terranix, colmena, ... } @ inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = import nixpkgs {
|
|
localSystem = system;
|
|
overlays = [
|
|
inputs.hydra.overlays.default
|
|
inputs.lix.overlays.default
|
|
inputs.nix-gerrit.overlays.default
|
|
];
|
|
};
|
|
lib = pkgs.lib;
|
|
terraform = pkgs.opentofu;
|
|
terraformCfg = terranix.lib.terranixConfiguration {
|
|
inherit system;
|
|
modules = [
|
|
./terraform
|
|
{
|
|
bagel.gandi.enable = true;
|
|
bagel.hydra.enable = true;
|
|
}
|
|
];
|
|
};
|
|
in
|
|
{
|
|
apps.${system} = {
|
|
tf = {
|
|
type = "app";
|
|
program = toString (pkgs.writers.writeBash "tf" ''
|
|
set -eo pipefail
|
|
ln -snf ${terraformCfg} config.tf.json
|
|
exec ${lib.getExe terraform} "$@"
|
|
'');
|
|
};
|
|
|
|
default = self.apps.${system}.tf;
|
|
};
|
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
|
packages = [
|
|
inputs.agenix.packages.${system}.agenix
|
|
|
|
pkgs.colmena
|
|
pkgs.opentofu
|
|
];
|
|
};
|
|
|
|
nixosConfigurations = (colmena.lib.makeHive self.outputs.colmena).nodes;
|
|
|
|
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 {
|
|
meta.nixpkgs = import nixpkgs {
|
|
localSystem = system;
|
|
overlays = [
|
|
inputs.hydra.overlays.default
|
|
inputs.lix.overlays.default
|
|
inputs.nix-gerrit.overlays.default
|
|
];
|
|
};
|
|
meta.specialArgs.inputs = inputs;
|
|
|
|
bagel-box.imports = commonModules ++ [ ./hosts/bagel-box ];
|
|
meta01.imports = commonModules ++ [ ./hosts/meta01 ];
|
|
gerrit01.imports = commonModules ++ [ ./hosts/gerrit01 ];
|
|
fodwatch.imports = commonModules ++ [ ./hosts/fodwatch ];
|
|
git.imports = commonModules ++ [ ./hosts/git ];
|
|
wob-vpn-gw.imports = commonModules ++ [ ./hosts/wob-vpn-gw ];
|
|
} // builders;
|
|
|
|
hydraJobs = builtins.mapAttrs (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
|
|
};
|
|
}
|