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 5094dcc..faa9355 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,16 +22,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1698266953, - "narHash": "sha256-jf72t7pC8+8h8fUslUYbWTX5rKsRwOzRMX8jJsGqDXA=", + "lastModified": 1698653593, + "narHash": "sha256-4SW5hJ7ktIO6j1+aNah0c9u+XDxjR4uYwPVtkVZynrs=", "owner": "Nixos", "repo": "nixpkgs", - "rev": "75a52265bda7fd25e06e3a67dee3f0354e73243c", + "rev": "423b31f1b24ec8d82baec9a5bb969da892010e6d", "type": "github" }, "original": { "owner": "Nixos", - "ref": "nixpkgs-unstable", + "ref": "nixos-unstable-small", "repo": "nixpkgs", "type": "github" } @@ -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": { 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 e06edd8..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 ''; @@ -130,7 +128,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 @@ -138,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