infra/flake.nix

176 lines
6.3 KiB
Nix
Raw Normal View History

2022-04-10 20:57:52 +02:00
{
description = "NixOS configuration of our builders";
2022-04-18 07:42:44 +02:00
nixConfig.extra-substituters = [
"https://nix-community.cachix.org"
"https://nixpkgs-update.cachix.org"
];
nixConfig.extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-update.cachix.org-1:6y6Z2JdoL3APdu6/+Iy8eZX2ajf09e4EE9SnxSML1W8="
];
2022-04-10 20:57:52 +02:00
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
2022-12-12 07:18:12 +10:00
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
nix-darwin.url = "github:LnL7/nix-darwin";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
2022-04-10 20:57:52 +02:00
sops-nix.url = "github:Mic92/sops-nix";
2022-09-25 07:27:35 +10:00
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
sops-nix.inputs.nixpkgs-stable.follows = "";
srvos.url = "github:numtide/srvos";
# actually not used when using the modules but than nothing ever will try to fetch this nixpkgs variant
srvos.inputs.nixpkgs.follows = "nixpkgs";
2023-08-05 12:07:01 +10:00
nixpkgs-update.url = "github:ryantm/nixpkgs-update/074e47e7a813312c758f8f121d82041d312b9413";
2023-01-15 23:47:28 +01:00
nixpkgs-update.inputs.mmdoc.follows = "";
2022-12-12 07:18:12 +10:00
nixpkgs-update-github-releases.url = "github:ryantm/nixpkgs-update-github-releases";
nixpkgs-update-github-releases.flake = false;
nur-update.url = "github:nix-community/nur-update";
nur-update.inputs.nixpkgs.follows = "nixpkgs";
2022-12-30 20:49:32 +01:00
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
2022-12-31 07:18:49 +01:00
hercules-ci-effects.url = "github:hercules-ci/hercules-ci-effects";
hercules-ci-effects.inputs.flake-parts.follows = "flake-parts";
hercules-ci-effects.inputs.hercules-ci-agent.follows = "";
hercules-ci-effects.inputs.nixpkgs.follows = "nixpkgs";
2022-12-31 07:18:49 +01:00
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
2023-05-19 23:51:43 +10:00
tf-pkgs.url = "github:NixOS/nixpkgs/5cc930fbdf3e069df2efc5de6dd728a9f13e9ba9";
2022-04-10 20:57:52 +02:00
};
outputs = inputs @ { flake-parts, self, ... }:
flake-parts.lib.mkFlake
{ inherit inputs; }
{
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
herculesCI = { lib, ... }: {
2023-07-18 06:48:41 +10:00
ciSystems = [ "x86_64-linux" "aarch64-linux" ];
onPush.default.outputs = {
checks = lib.mkForce self.outputs.checks.x86_64-linux;
};
};
hercules-ci.flake-update = {
enable = true;
createPullRequest = true;
autoMergeMethod = "rebase";
when = {
hour = [ 2 ];
dayOfWeek = [ "Mon" "Thu" ];
};
2023-05-02 18:35:18 +10:00
};
imports = [
inputs.hercules-ci-effects.flakeModule
inputs.treefmt-nix.flakeModule
./dev/effect.nix
];
2022-12-31 07:18:49 +01:00
hercules-ci.github-pages.branch = "master";
2023-04-26 16:19:18 +10:00
perSystem = { config, pkgs, ... }: {
2023-05-19 23:51:43 +10:00
imports = [ ./dev/shell.nix ./terraform/shell.nix ];
treefmt.imports = [ ./dev/treefmt.nix ];
2023-04-26 16:19:18 +10:00
checks = pkgs.lib.optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") {
2023-07-14 17:11:27 +10:00
nixosTests-hydra = pkgs.nixosTests.hydra.hydra_unstable;
nixosTests-lemmy = pkgs.nixosTests.lemmy;
nixosTests-pict-rs = pkgs.nixosTests.pict-rs;
};
hercules-ci.github-pages.settings.contents = pkgs.runCommand "pages"
{
buildInputs = [ config.devShells.mkdocs.nativeBuildInputs ];
} ''
cd ${self}
mkdocs build --strict --site-dir $out
'';
};
2023-05-16 18:58:13 +10:00
flake.darwinConfigurations =
let
2023-06-05 15:34:12 +10:00
inherit (self.lib) darwinSystem;
2023-05-16 18:58:13 +10:00
in
{
darwin02 = darwinSystem {
system = "aarch64-darwin";
modules = [ ./hosts/darwin02/configuration.nix ];
};
2023-07-17 09:37:43 +10:00
darwin03 = darwinSystem {
system = "aarch64-darwin";
modules = [ ./hosts/darwin03/configuration.nix ];
};
2023-05-16 18:58:13 +10:00
};
flake.nixosConfigurations =
let
2023-05-16 09:53:27 +10:00
inherit (self.lib) nixosSystem;
in
{
build01 = nixosSystem {
system = "x86_64-linux";
2023-05-18 13:24:26 +10:00
modules = [ ./hosts/build01/configuration.nix ];
};
build02 = nixosSystem {
system = "x86_64-linux";
2023-05-18 13:24:26 +10:00
modules = [ ./hosts/build02/configuration.nix ];
};
build03 = nixosSystem {
system = "x86_64-linux";
2023-05-18 13:24:26 +10:00
modules = [ ./hosts/build03/configuration.nix ];
};
build04 = nixosSystem {
system = "aarch64-linux";
2023-05-18 13:24:26 +10:00
modules = [ ./hosts/build04/configuration.nix ];
};
web01 = nixosSystem {
system = "x86_64-linux";
modules = [ ./hosts/web01/configuration.nix ];
};
2023-07-22 09:50:53 +10:00
web02 = nixosSystem {
system = "x86_64-linux";
modules = [ ./hosts/web02/configuration.nix ];
};
};
2023-05-16 09:53:27 +10:00
2023-07-17 13:53:06 +10:00
flake.darwinModules = {
common = ./modules/darwin/common;
2023-09-07 12:47:33 +10:00
builder = ./modules/darwin/builder.nix;
2023-07-17 13:53:06 +10:00
hercules-ci = ./modules/darwin/hercules-ci;
remote-builder = ./modules/darwin/remote-builder.nix;
2023-07-17 13:53:06 +10:00
};
2023-05-17 07:21:20 +10:00
flake.nixosModules = {
common = ./modules/nixos/common;
2023-05-17 07:21:20 +10:00
2023-09-07 12:47:33 +10:00
builder = ./modules/nixos/builder.nix;
community-builder = ./modules/nixos/community-builder;
2023-05-07 10:24:44 +10:00
github-org-backup = ./modules/nixos/github-org-backup.nix;
2023-05-17 07:21:20 +10:00
hercules-ci = ./modules/nixos/hercules-ci;
hydra = ./modules/nixos/hydra.nix;
2023-07-21 20:18:58 +10:00
monitoring = ./modules/nixos/monitoring;
nur-update = ./modules/nixos/nur-update.nix;
remote-builder = ./modules/nixos/remote-builder/default.nix;
remote-builder-build04 = ./modules/nixos/remote-builder/build04.nix;
2023-06-03 17:04:10 +10:00
remote-builder-darwin02 = ./modules/nixos/remote-builder/darwin02.nix;
2023-07-17 09:37:43 +10:00
remote-builder-darwin03 = ./modules/nixos/remote-builder/darwin03.nix;
watch-store = ./modules/nixos/cachix/watch-store.nix;
2023-05-17 07:21:20 +10:00
zfs = ./modules/nixos/zfs.nix;
};
2023-06-05 15:34:12 +10:00
flake.lib.darwinSystem = args:
inputs.nix-darwin.lib.darwinSystem ({ specialArgs = { inherit inputs; }; } // args);
2023-05-16 09:53:27 +10:00
flake.lib.nixosSystem = args:
inputs.nixpkgs.lib.nixosSystem ({ specialArgs = { inherit inputs; }; } // args);
};
2022-04-10 20:57:52 +02:00
}