buildbot-nix/flake.nix

55 lines
2 KiB
Nix
Raw Normal View History

2023-09-10 08:22:33 +00:00
{
# https://github.com/Mic92/buildbot-nix
description = "A nixos module to make buildbot a proper Nix-CI.";
inputs = {
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, ... }:
{
imports = [
./nix/checks/flake-module.nix
] ++ inputs.nixpkgs.lib.optional (inputs.treefmt-nix ? flakeModule) ./nix/treefmt/flake-module.nix;
systems = [ "x86_64-linux" ];
2023-09-15 07:10:02 +00:00
flake = {
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
];
};
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
}