2023-09-10 08:22:33 +00:00
|
|
|
{
|
2024-05-06 16:26:48 +00:00
|
|
|
# Original: https://github.com/Mic92/buildbot-nix
|
|
|
|
# https://git.lix.systems/lix-project/buildbot-nix
|
|
|
|
description = "A NixOS module to make buildbot a proper Nix-CI for Gerrit.";
|
2023-09-10 08:22:33 +00:00
|
|
|
|
|
|
|
inputs = {
|
2023-11-20 08:43:44 +00:00
|
|
|
nixpkgs.url = "github:Nixos/nixpkgs/nixos-unstable-small";
|
2023-09-10 08:22:33 +00:00
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2023-09-13 21:31:20 +00:00
|
|
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
2023-09-17 20:14:56 +00:00
|
|
|
|
|
|
|
# used for development
|
|
|
|
treefmt-nix.url = "github:numtide/treefmt-nix";
|
|
|
|
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
|
2023-09-10 08:22:33 +00:00
|
|
|
};
|
|
|
|
|
2023-09-13 21:31:20 +00:00
|
|
|
outputs = inputs@{ self, flake-parts, ... }:
|
2023-09-15 07:10:02 +00:00
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }:
|
|
|
|
{
|
2023-09-24 07:08:03 +00:00
|
|
|
imports = [
|
|
|
|
./nix/checks/flake-module.nix
|
|
|
|
] ++ inputs.nixpkgs.lib.optional (inputs.treefmt-nix ? flakeModule) ./nix/treefmt/flake-module.nix;
|
2023-10-27 09:04:05 +00:00
|
|
|
systems = [ "x86_64-linux" ];
|
2023-09-15 07:10:02 +00:00
|
|
|
flake = {
|
2024-03-02 15:11:47 +00:00
|
|
|
nixosModules.buildbot-coordinator = ./nix/coordinator.nix;
|
2023-09-15 07:10:02 +00:00
|
|
|
nixosModules.buildbot-worker = ./nix/worker.nix;
|
2023-09-10 09:16:51 +00:00
|
|
|
|
2023-09-15 07:10:02 +00:00
|
|
|
nixosConfigurations =
|
|
|
|
let
|
|
|
|
examplesFor = system: import ./examples {
|
|
|
|
inherit system;
|
|
|
|
inherit (inputs) nixpkgs;
|
|
|
|
buildbot-nix = self;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
examplesFor "x86_64-linux" // examplesFor "aarch64-linux";
|
2023-09-10 09:16:51 +00:00
|
|
|
};
|
2023-09-15 07:10:02 +00:00
|
|
|
perSystem = { self', pkgs, system, ... }: {
|
|
|
|
packages.default = pkgs.mkShell {
|
|
|
|
packages = [
|
|
|
|
pkgs.bashInteractive
|
2023-12-26 18:48:27 +00:00
|
|
|
pkgs.mypy
|
|
|
|
pkgs.ruff
|
2023-09-15 07:10:02 +00:00
|
|
|
];
|
|
|
|
};
|
2023-10-31 10:32:05 +00:00
|
|
|
packages.buildbot-nix = pkgs.python3.pkgs.callPackage ./default.nix { };
|
2023-09-15 07:10:02 +00:00
|
|
|
checks =
|
|
|
|
let
|
|
|
|
nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
|
|
|
|
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
|
|
|
|
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
|
|
|
|
in
|
|
|
|
nixosMachines // packages // devShells;
|
2023-09-10 09:16:51 +00:00
|
|
|
};
|
2023-09-15 07:10:02 +00:00
|
|
|
});
|
2023-09-10 08:22:33 +00:00
|
|
|
}
|