buildbot: tie the knot through a scope to make it overridable

Currently it is impossible to overlay buildbot since all the references
between components are directly bound to the values in scope. Let's fix
this by introducing a scope so you can overrideScope parts of buildbot.

I also changed buildbot-worker to use our overridden python, which is no
functional change, but makes things more consistent.

+111 -116
+18 -23
pkgs/development/tools/continuous-integration/buildbot/default.nix
··· 1 - { python3 2 - , fetchPypi 1 + { lib 2 + , newScope 3 + , python3 3 4 , recurseIntoAttrs 4 - , callPackage 5 5 }: 6 - let 6 + # Take packages from self first, then python.pkgs (and secondarily pkgs) 7 + lib.makeScope (self: newScope (self.python.pkgs // self)) (self: { 7 8 python = python3.override { 8 9 packageOverrides = self: super: { 9 10 sqlalchemy = super.sqlalchemy_1_4; 10 - moto = super.moto.overridePythonAttrs (oldAttrs: rec { 11 + moto = super.moto.overridePythonAttrs (oldAttrs: { 11 12 # a lot of tests -> very slow, we already build them when building python packages 12 13 doCheck = false; 13 14 }); 14 15 }; 15 16 }; 16 17 17 - buildbot-pkg = python.pkgs.callPackage ./pkg.nix { 18 - inherit buildbot; 19 - }; 20 - buildbot-worker = python3.pkgs.callPackage ./worker.nix { 21 - inherit buildbot; 22 - }; 23 - buildbot = python.pkgs.callPackage ./master.nix { 24 - inherit buildbot-pkg buildbot-worker buildbot-plugins; 25 - }; 26 - buildbot-plugins = recurseIntoAttrs (callPackage ./plugins.nix { 27 - inherit buildbot-pkg; 28 - }); 29 - in 30 - { 31 - inherit buildbot buildbot-plugins buildbot-worker; 32 - buildbot-ui = buildbot.withPlugins (with buildbot-plugins; [ www ]); 33 - buildbot-full = buildbot.withPlugins (with buildbot-plugins; [ 18 + buildbot-pkg = self.callPackage ./pkg.nix { }; 19 + 20 + buildbot-worker = self.callPackage ./worker.nix { }; 21 + 22 + buildbot = self.callPackage ./master.nix { }; 23 + 24 + buildbot-plugins = recurseIntoAttrs (self.callPackage ./plugins.nix { }); 25 + 26 + buildbot-ui = self.buildbot.withPlugins (with self.buildbot-plugins; [ www ]); 27 + 28 + buildbot-full = self.buildbot.withPlugins (with self.buildbot-plugins; [ 34 29 www console-view waterfall-view grid-view wsgi-dashboards badges 35 30 ]); 36 - } 31 + })
+91 -91
pkgs/development/tools/continuous-integration/buildbot/master.nix
··· 1 1 { lib 2 2 , stdenv 3 - , buildPythonPackage 4 3 , buildPythonApplication 5 4 , fetchPypi 6 5 , makeWrapper 6 + # Tie withPlugins through the fixed point here, so it will receive an 7 + # overridden version properly 8 + , buildbot 7 9 , pythonOlder 8 10 , python 9 11 , twisted ··· 38 40 , unidiff 39 41 , glibcLocales 40 42 , nixosTests 41 - , callPackage 42 43 }: 43 44 44 45 let 45 46 withPlugins = plugins: buildPythonApplication { 46 - pname = "${package.pname}-with-plugins"; 47 - inherit (package) version; 47 + pname = "${buildbot.pname}-with-plugins"; 48 + inherit (buildbot) version; 48 49 format = "other"; 49 50 50 51 dontUnpack = true; ··· 55 56 makeWrapper 56 57 ]; 57 58 58 - propagatedBuildInputs = plugins ++ package.propagatedBuildInputs; 59 + propagatedBuildInputs = plugins ++ buildbot.propagatedBuildInputs; 59 60 60 61 installPhase = '' 61 - makeWrapper ${package}/bin/buildbot $out/bin/buildbot \ 62 - --prefix PYTHONPATH : "${package}/${python.sitePackages}:$PYTHONPATH" 63 - ln -sfv ${package}/lib $out/lib 62 + makeWrapper ${buildbot}/bin/buildbot $out/bin/buildbot \ 63 + --prefix PYTHONPATH : "${buildbot}/${python.sitePackages}:$PYTHONPATH" 64 + ln -sfv ${buildbot}/lib $out/lib 64 65 ''; 65 66 66 - passthru = package.passthru // { 67 + passthru = buildbot.passthru // { 67 68 withPlugins = morePlugins: withPlugins (morePlugins ++ plugins); 68 69 }; 69 70 }; 71 + in 72 + buildPythonApplication rec { 73 + pname = "buildbot"; 74 + version = "3.11.1"; 75 + format = "pyproject"; 70 76 71 - package = buildPythonApplication rec { 72 - pname = "buildbot"; 73 - version = "3.11.1"; 74 - format = "pyproject"; 77 + disabled = pythonOlder "3.8"; 75 78 76 - disabled = pythonOlder "3.8"; 79 + src = fetchPypi { 80 + inherit pname version; 81 + hash = "sha256-ruYW1sVoGvFMi+NS+xiNsn0Iq2RmKlax4bxHgYrj6ZY="; 82 + }; 77 83 78 - src = fetchPypi { 79 - inherit pname version; 80 - hash = "sha256-ruYW1sVoGvFMi+NS+xiNsn0Iq2RmKlax4bxHgYrj6ZY="; 81 - }; 84 + propagatedBuildInputs = [ 85 + # core 86 + twisted 87 + jinja2 88 + msgpack 89 + zope-interface 90 + sqlalchemy 91 + alembic 92 + python-dateutil 93 + txaio 94 + autobahn 95 + pyjwt 96 + pyyaml 97 + setuptools 98 + croniter 99 + importlib-resources 100 + packaging 101 + unidiff 102 + ] 103 + # tls 104 + ++ twisted.optional-dependencies.tls; 82 105 83 - propagatedBuildInputs = [ 84 - # core 85 - twisted 86 - jinja2 87 - msgpack 88 - zope-interface 89 - sqlalchemy 90 - alembic 91 - python-dateutil 92 - txaio 93 - autobahn 94 - pyjwt 95 - pyyaml 96 - setuptools 97 - croniter 98 - importlib-resources 99 - packaging 100 - unidiff 101 - ] 102 - # tls 103 - ++ twisted.optional-dependencies.tls; 104 - 105 - nativeCheckInputs = [ 106 - treq 107 - txrequests 108 - pypugjs 109 - boto3 110 - moto 111 - markdown 112 - lz4 113 - setuptools-trial 114 - buildbot-worker 115 - buildbot-pkg 116 - buildbot-plugins.www 117 - parameterized 118 - git 119 - openssh 120 - glibcLocales 121 - ]; 106 + nativeCheckInputs = [ 107 + treq 108 + txrequests 109 + pypugjs 110 + boto3 111 + moto 112 + markdown 113 + lz4 114 + setuptools-trial 115 + buildbot-worker 116 + buildbot-pkg 117 + buildbot-plugins.www 118 + parameterized 119 + git 120 + openssh 121 + glibcLocales 122 + ]; 122 123 123 - patches = [ 124 - # This patch disables the test that tries to read /etc/os-release which 125 - # is not accessible in sandboxed builds. 126 - ./skip_test_linux_distro.patch 127 - ]; 124 + patches = [ 125 + # This patch disables the test that tries to read /etc/os-release which 126 + # is not accessible in sandboxed builds. 127 + ./skip_test_linux_distro.patch 128 + ]; 128 129 129 - postPatch = '' 130 - substituteInPlace buildbot/scripts/logwatcher.py --replace '/usr/bin/tail' "$(type -P tail)" 131 - ''; 130 + postPatch = '' 131 + substituteInPlace buildbot/scripts/logwatcher.py --replace '/usr/bin/tail' "$(type -P tail)" 132 + ''; 132 133 133 - # Silence the depreciation warning from SqlAlchemy 134 - SQLALCHEMY_SILENCE_UBER_WARNING = 1; 134 + # Silence the depreciation warning from SqlAlchemy 135 + SQLALCHEMY_SILENCE_UBER_WARNING = 1; 135 136 136 - # TimeoutErrors on slow machines -> aarch64 137 - doCheck = !stdenv.isAarch64; 137 + # TimeoutErrors on slow machines -> aarch64 138 + doCheck = !stdenv.isAarch64; 138 139 139 - preCheck = '' 140 - export LC_ALL="en_US.UTF-8" 141 - export PATH="$out/bin:$PATH" 140 + preCheck = '' 141 + export LC_ALL="en_US.UTF-8" 142 + export PATH="$out/bin:$PATH" 142 143 143 - # remove testfile which is missing configuration file from sdist 144 - rm buildbot/test/integration/test_graphql.py 145 - # tests in this file are flaky, see https://github.com/buildbot/buildbot/issues/6776 146 - rm buildbot/test/integration/test_try_client.py 147 - ''; 144 + # remove testfile which is missing configuration file from sdist 145 + rm buildbot/test/integration/test_graphql.py 146 + # tests in this file are flaky, see https://github.com/buildbot/buildbot/issues/6776 147 + rm buildbot/test/integration/test_try_client.py 148 + ''; 148 149 149 - passthru = { 150 - inherit withPlugins; 151 - tests.buildbot = nixosTests.buildbot; 152 - updateScript = ./update.sh; 153 - }; 150 + passthru = { 151 + inherit withPlugins; 152 + tests.buildbot = nixosTests.buildbot; 153 + updateScript = ./update.sh; 154 + }; 154 155 155 - meta = with lib; { 156 - description = "An open-source continuous integration framework for automating software build, test, and release processes"; 157 - homepage = "https://buildbot.net/"; 158 - changelog = "https://github.com/buildbot/buildbot/releases/tag/v${version}"; 159 - maintainers = teams.buildbot.members; 160 - license = licenses.gpl2Only; 161 - broken = stdenv.isDarwin; 162 - }; 156 + meta = with lib; { 157 + description = "An open-source continuous integration framework for automating software build, test, and release processes"; 158 + homepage = "https://buildbot.net/"; 159 + changelog = "https://github.com/buildbot/buildbot/releases/tag/v${version}"; 160 + maintainers = teams.buildbot.members; 161 + license = licenses.gpl2Only; 162 + broken = stdenv.isDarwin; 163 163 }; 164 - in package 164 + }
+2 -2
pkgs/top-level/all-packages.nix
··· 3581 3581 bucklespring-libinput = callPackage ../applications/audio/bucklespring { }; 3582 3582 bucklespring-x11 = callPackage ../applications/audio/bucklespring { legacy = true; }; 3583 3583 3584 - inherit (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot {}) 3585 - buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker; 3584 + buildbotPackages = recurseIntoAttrs (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot { }); 3585 + inherit (buildbotPackages) buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker; 3586 3586 3587 3587 bunyan-rs = callPackage ../development/tools/bunyan-rs { }; 3588 3588