add buildbot_nix as a python package to buildbot

This commit is contained in:
Jörg Thalheim 2023-10-31 11:32:05 +01:00
parent a65ad19e93
commit 4966c611aa
5 changed files with 42 additions and 7 deletions

7
default.nix Normal file
View file

@ -0,0 +1,7 @@
{ setuptools, buildPythonPackage }:
buildPythonPackage {
name = "buildbot-nix";
format = "pyproject";
src = ./.;
nativeBuildInputs = [ setuptools ];
}

View file

@ -22,16 +22,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1698553279, "lastModified": 1698653593,
"narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=", "narHash": "sha256-4SW5hJ7ktIO6j1+aNah0c9u+XDxjR4uYwPVtkVZynrs=",
"owner": "Nixos", "owner": "Nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035", "rev": "423b31f1b24ec8d82baec9a5bb969da892010e6d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "Nixos", "owner": "Nixos",
"ref": "nixpkgs-unstable", "ref": "nixos-unstable-small",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }

View file

@ -3,7 +3,7 @@
description = "A nixos module to make buildbot a proper Nix-CI."; description = "A nixos module to make buildbot a proper Nix-CI.";
inputs = { inputs = {
nixpkgs.url = "github:Nixos/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:Nixos/nixpkgs/nixos-unstable-small";
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
@ -39,6 +39,7 @@
pkgs.bashInteractive pkgs.bashInteractive
]; ];
}; };
packages.buildbot-nix = pkgs.python3.pkgs.callPackage ./default.nix { };
checks = checks =
let let
nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations); nixosMachines = lib.mapAttrs' (name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel) ((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);

View file

@ -86,8 +86,6 @@ in
services.buildbot-master = { services.buildbot-master = {
enable = true; enable = true;
extraImports = '' extraImports = ''
import sys
sys.path.append("${../buildbot_nix}")
from datetime import timedelta from datetime import timedelta
from buildbot_nix import GithubConfig, NixConfigurator from buildbot_nix import GithubConfig, NixConfigurator
''; '';
@ -137,10 +135,12 @@ in
pkgs.buildbot-plugins.grid-view pkgs.buildbot-plugins.grid-view
pkgs.buildbot-plugins.wsgi-dashboards pkgs.buildbot-plugins.wsgi-dashboards
pkgs.buildbot-plugins.badges pkgs.buildbot-plugins.badges
(pkgs.python3.pkgs.callPackage ../default.nix { })
]; ];
}; };
systemd.services.buildbot-master = { systemd.services.buildbot-master = {
after = [ "postgresql.service" ];
serviceConfig = { serviceConfig = {
# in master.py we read secrets from $CREDENTIALS_DIRECTORY # in master.py we read secrets from $CREDENTIALS_DIRECTORY
LoadCredential = [ LoadCredential = [

View file

@ -1,3 +1,30 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "buildbot-nix"
authors = [
{ name = "Jörg Thalheim", email = "joerg@thalheim.io" },
]
description = "A nixos module to make buildbot a proper Nix-CI."
readme = "README.rst"
requires-python = ">=3.9"
license = {text = "MIT"}
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python"
]
version = "0.0.1"
[tool.setuptools]
packages = ["buildbot_nix"]
[tool.ruff] [tool.ruff]
target-version = "py311" target-version = "py311"
line-length = 88 line-length = 88