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

View file

@ -3,7 +3,7 @@
description = "A nixos module to make buildbot a proper Nix-CI.";
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.inputs.nixpkgs-lib.follows = "nixpkgs";
@ -39,6 +39,7 @@
pkgs.bashInteractive
];
};
packages.buildbot-nix = pkgs.python3.pkgs.callPackage ./default.nix { };
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);

View file

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