From 7d317826c0b2fee0dee2e90227ca844307b212ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 30 Oct 2023 10:53:44 +0100 Subject: [PATCH 1/3] drop setuptools from PYTHONPATH fixed in nixpkgs in https://nixpk.gs/pr-tracker.html?pr=263963 --- nix/master.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nix/master.nix b/nix/master.nix index e06edd8..c0c0525 100644 --- a/nix/master.nix +++ b/nix/master.nix @@ -130,7 +130,6 @@ in ps.treq ps.psycopg2 (ps.toPythonModule pkgs.buildbot-worker) - ps.setuptools pkgs.buildbot-plugins.www pkgs.buildbot-plugins.www-react pkgs.buildbot-plugins.console-view From a65ad19e935352320c76b8283852283ca7c3d260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 31 Oct 2023 10:48:06 +0100 Subject: [PATCH 2/3] flake.lock: Update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'flake-parts': 'github:hercules-ci/flake-parts/c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4' (2023-10-03) → 'github:hercules-ci/flake-parts/f76e870d64779109e41370848074ac4eaa1606ec' (2023-10-29) • Updated input 'nixpkgs': 'github:Nixos/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c' (2023-10-25) → 'github:Nixos/nixpkgs/90e85bc7c1a6fc0760a94ace129d3a1c61c3d035' (2023-10-29) • Updated input 'treefmt-nix': 'github:numtide/treefmt-nix/aae39f64f5ecbe89792d05eacea5cb241891292a' (2023-10-15) → 'github:numtide/treefmt-nix/5deb8dc125a9f83b65ca86cf0c8167c46593e0b1' (2023-10-27) --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 5094dcc..691eb82 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1696343447, - "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "lastModified": 1698579227, + "narHash": "sha256-KVWjFZky+gRuWennKsbo6cWyo7c/z/VgCte5pR9pEKg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "rev": "f76e870d64779109e41370848074ac4eaa1606ec", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698266953, - "narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=", + "lastModified": 1698553279, + "narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=", "owner": "Nixos", "repo": "nixpkgs", - "rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c", + "rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035", "type": "github" }, "original": { @@ -50,11 +50,11 @@ ] }, "locked": { - "lastModified": 1697388351, - "narHash": "sha256-63N2eBpKaziIy4R44vjpUu8Nz5fCJY7okKrkixvDQmY=", + "lastModified": 1698438538, + "narHash": "sha256-AWxaKTDL3MtxaVTVU5lYBvSnlspOS0Fjt8GxBgnU0Do=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "aae39f64f5ecbe89792d05eacea5cb241891292a", + "rev": "5deb8dc125a9f83b65ca86cf0c8167c46593e0b1", "type": "github" }, "original": { From 4966c611aa5d74dcb9a61c0cf2347860c76de034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 31 Oct 2023 11:32:05 +0100 Subject: [PATCH 3/3] add buildbot_nix as a python package to buildbot --- default.nix | 7 +++++++ flake.lock | 8 ++++---- flake.nix | 3 ++- nix/master.nix | 4 ++-- pyproject.toml | 27 +++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..92db2ed --- /dev/null +++ b/default.nix @@ -0,0 +1,7 @@ +{ setuptools, buildPythonPackage }: +buildPythonPackage { + name = "buildbot-nix"; + format = "pyproject"; + src = ./.; + nativeBuildInputs = [ setuptools ]; +} diff --git a/flake.lock b/flake.lock index 691eb82..faa9355 100644 --- a/flake.lock +++ b/flake.lock @@ -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" } diff --git a/flake.nix b/flake.nix index 6740723..53c1036 100644 --- a/flake.nix +++ b/flake.nix @@ -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); diff --git a/nix/master.nix b/nix/master.nix index c0c0525..ce0756f 100644 --- a/nix/master.nix +++ b/nix/master.nix @@ -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 = [ diff --git a/pyproject.toml b/pyproject.toml index 8dc587c..8969d53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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