infra/flake.nix

121 lines
4 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 = {
2022-12-12 07:18:12 +10:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.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";
2022-12-12 07:18:12 +10:00
nixpkgs-update.url = "github:ryantm/nixpkgs-update";
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/5751551558d7896ffb30ff3d709b4943bb3eafa8";
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, ... }: {
ciSystems = [ "x86_64-linux" "aarch64-linux" ];
onPush.default.outputs = {
checks = lib.mkForce self.outputs.checks.x86_64-linux;
packages = lib.mkForce self.outputs.packages.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
./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
packages.pages = pkgs.runCommand "pages"
{
buildInputs = [ pkgs.python3.pkgs.mkdocs-material ];
} ''
cp -r ${pkgs.lib.cleanSource ./.}/* .
mkdocs build --strict --site-dir $out
'';
2023-04-26 16:19:18 +10:00
hercules-ci.github-pages.settings.contents = config.packages.pages;
};
flake.nixosConfigurations =
let
2023-05-16 09:53:27 +10:00
inherit (self.lib) nixosSystem;
in
{
build01 = nixosSystem {
system = "x86_64-linux";
2023-05-16 09:53:27 +10:00
modules = [ ./build01/configuration.nix ];
};
build02 = nixosSystem {
system = "x86_64-linux";
2023-05-16 09:53:27 +10:00
modules = [ ./build02/configuration.nix ];
};
build03 = nixosSystem {
system = "x86_64-linux";
2023-05-16 09:53:27 +10:00
modules = [ ./build03/configuration.nix ];
};
build04 = nixosSystem {
system = "aarch64-linux";
2023-05-16 09:53:27 +10:00
modules = [ ./build04/configuration.nix ];
};
};
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
}