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
|
|
|
|
|
|
|
lix.follows = "hydra/nix";
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
|
|
|
|
2024-07-02 09:08:19 +00:00
|
|
|
outputs = { self, nixpkgs, terranix, ... } @ inputs:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
localSystem = system;
|
|
|
|
overlays = [
|
|
|
|
inputs.hydra.overlays.default
|
|
|
|
inputs.lix.overlays.default
|
|
|
|
];
|
|
|
|
};
|
|
|
|
lib = pkgs.lib;
|
|
|
|
terraform = pkgs.opentofu;
|
|
|
|
terraformCfg = terranix.lib.terranixConfiguration {
|
|
|
|
inherit system;
|
2024-07-04 11:54:50 +00:00
|
|
|
modules = [
|
|
|
|
./terraform
|
|
|
|
{
|
|
|
|
bagel.hydra.enable = true;
|
|
|
|
}
|
|
|
|
];
|
2024-07-02 09:08:19 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
apps.${system} = {
|
|
|
|
apply = {
|
|
|
|
type = "app";
|
|
|
|
program = toString (pkgs.writers.writeBash "apply" ''
|
|
|
|
set -eo pipefail
|
|
|
|
rm -f config.tf.json
|
|
|
|
cp ${terraformCfg} config.tf.json
|
|
|
|
${lib.getExe terraform} init
|
|
|
|
${lib.getExe terraform} apply
|
|
|
|
'');
|
|
|
|
};
|
2024-07-04 11:54:50 +00:00
|
|
|
plan = {
|
|
|
|
type = "app";
|
|
|
|
program = toString (pkgs.writers.writeBash "plan" ''
|
|
|
|
set -eo pipefail
|
|
|
|
rm -f config.tf.json
|
|
|
|
cp ${terraformCfg} config.tf.json
|
|
|
|
${lib.getExe terraform} init
|
|
|
|
${lib.getExe terraform} plan
|
|
|
|
'');
|
|
|
|
};
|
2024-07-07 16:02:55 +00:00
|
|
|
# nix run ".#destroy"
|
|
|
|
destroy = {
|
|
|
|
type = "app";
|
|
|
|
program = toString (pkgs.writers.writeBash "destroy" ''
|
|
|
|
set -eo pipefail
|
|
|
|
ln -snf ${terraformCfg} config.tf.json
|
|
|
|
${lib.getExe terraform} init
|
|
|
|
${lib.getExe terraform} destroy
|
|
|
|
'');
|
2024-07-02 09:08:19 +00:00
|
|
|
};
|
2024-07-07 16:02:55 +00:00
|
|
|
|
|
|
|
default = self.apps.${system}.apply;
|
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
|
|
|
|
inputs.colmena.packages.${system}.colmena
|
2024-07-04 11:54:50 +00:00
|
|
|
|
|
|
|
pkgs.opentofu
|
2024-07-05 09:43:53 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-06-23 04:41:53 +00:00
|
|
|
colmena = {
|
|
|
|
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-06-23 04:41:53 +00:00
|
|
|
};
|
2024-06-24 14:45:59 +00:00
|
|
|
meta.specialArgs.inputs = inputs;
|
|
|
|
|
2024-06-23 04:41:53 +00:00
|
|
|
bagel-box = {
|
2024-06-24 14:45:59 +00:00
|
|
|
imports = [
|
2024-06-24 16:03:07 +00:00
|
|
|
inputs.agenix.nixosModules.default
|
2024-06-24 14:45:59 +00:00
|
|
|
inputs.hydra.nixosModules.hydra
|
|
|
|
|
|
|
|
./services
|
2024-07-05 11:29:56 +00:00
|
|
|
./common
|
2024-06-24 14:45:59 +00:00
|
|
|
./hosts/bagel-box
|
|
|
|
];
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
2024-07-01 17:11:01 +00:00
|
|
|
|
|
|
|
meta01 = {
|
|
|
|
imports = [
|
|
|
|
inputs.agenix.nixosModules.default
|
|
|
|
inputs.hydra.nixosModules.hydra
|
|
|
|
|
|
|
|
./services
|
|
|
|
./common
|
|
|
|
./hosts/meta01.nixpkgs.lahfa.xyz
|
|
|
|
];
|
|
|
|
};
|
2024-07-01 17:49:32 +00:00
|
|
|
|
|
|
|
gerrit01 = {
|
|
|
|
imports = [
|
|
|
|
inputs.agenix.nixosModules.default
|
|
|
|
inputs.hydra.nixosModules.hydra
|
|
|
|
|
|
|
|
./services
|
|
|
|
./common
|
2024-07-03 08:58:49 +00:00
|
|
|
./hosts/cl.forkos.org
|
2024-07-01 17:49:32 +00:00
|
|
|
];
|
|
|
|
};
|
2024-07-05 17:14:58 +00:00
|
|
|
|
|
|
|
fodwatch = {
|
|
|
|
imports = [
|
|
|
|
inputs.agenix.nixosModules.default
|
|
|
|
inputs.hydra.nixosModules.hydra
|
|
|
|
|
|
|
|
./services
|
|
|
|
./common
|
|
|
|
./hosts/fodwatch.forkos.org
|
|
|
|
];
|
|
|
|
};
|
2024-06-23 04:41:53 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|