Commit ebf346ff authored by Jade Lovelace's avatar Jade Lovelace
Browse files

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.
parent ef65f5b4
Loading
Loading
Loading
Loading
+18 −23
Original line number Diff line number Diff line
{ python3
, fetchPypi
{ lib
, newScope
, python3
, recurseIntoAttrs
, callPackage
}:
let
# Take packages from self first, then python.pkgs (and secondarily pkgs)
lib.makeScope (self: newScope (self.python.pkgs // self)) (self: {
  python = python3.override {
    packageOverrides = self: super: {
      sqlalchemy = super.sqlalchemy_1_4;
      moto = super.moto.overridePythonAttrs (oldAttrs: rec {
      moto = super.moto.overridePythonAttrs (oldAttrs: {
        # a lot of tests -> very slow, we already build them when building python packages
        doCheck = false;
      });
    };
  };

  buildbot-pkg = python.pkgs.callPackage ./pkg.nix {
    inherit buildbot;
  };
  buildbot-worker = python3.pkgs.callPackage ./worker.nix {
    inherit buildbot;
  };
  buildbot = python.pkgs.callPackage ./master.nix {
    inherit buildbot-pkg buildbot-worker buildbot-plugins;
  };
  buildbot-plugins = recurseIntoAttrs (callPackage ./plugins.nix {
    inherit buildbot-pkg;
  });
in
{
  inherit buildbot buildbot-plugins buildbot-worker;
  buildbot-ui = buildbot.withPlugins (with buildbot-plugins; [ www ]);
  buildbot-full = buildbot.withPlugins (with buildbot-plugins; [
  buildbot-pkg = self.callPackage ./pkg.nix { };

  buildbot-worker = self.callPackage ./worker.nix { };

  buildbot = self.callPackage ./master.nix { };

  buildbot-plugins = recurseIntoAttrs (self.callPackage ./plugins.nix { });

  buildbot-ui = self.buildbot.withPlugins (with self.buildbot-plugins; [ www ]);

  buildbot-full = self.buildbot.withPlugins (with self.buildbot-plugins; [
    www console-view waterfall-view grid-view wsgi-dashboards badges
  ]);
}
})
+99 −99
Original line number Diff line number Diff line
{ lib
, stdenv
, buildPythonPackage
, buildPythonApplication
, fetchPypi
, makeWrapper
# Tie withPlugins through the fixed point here, so it will receive an
# overridden version properly
, buildbot
, pythonOlder
, python
, twisted
@@ -38,13 +40,12 @@
, unidiff
, glibcLocales
, nixosTests
, callPackage
}:

let
  withPlugins = plugins: buildPythonApplication {
    pname = "${package.pname}-with-plugins";
    inherit (package) version;
    pname = "${buildbot.pname}-with-plugins";
    inherit (buildbot) version;
    format = "other";

    dontUnpack = true;
@@ -55,20 +56,20 @@ let
      makeWrapper
    ];

    propagatedBuildInputs = plugins ++ package.propagatedBuildInputs;
    propagatedBuildInputs = plugins ++ buildbot.propagatedBuildInputs;

    installPhase = ''
      makeWrapper ${package}/bin/buildbot $out/bin/buildbot \
        --prefix PYTHONPATH : "${package}/${python.sitePackages}:$PYTHONPATH"
      ln -sfv ${package}/lib $out/lib
      makeWrapper ${buildbot}/bin/buildbot $out/bin/buildbot \
        --prefix PYTHONPATH : "${buildbot}/${python.sitePackages}:$PYTHONPATH"
      ln -sfv ${buildbot}/lib $out/lib
    '';

    passthru = package.passthru // {
    passthru = buildbot.passthru // {
      withPlugins = morePlugins: withPlugins (morePlugins ++ plugins);
    };
  };

  package = buildPythonApplication rec {
in
buildPythonApplication rec {
  pname = "buildbot";
  version = "3.11.1";
  format = "pyproject";
@@ -160,5 +161,4 @@ let
    license = licenses.gpl2Only;
    broken = stdenv.isDarwin;
  };
  };
in package
}
+2 −2
Original line number Diff line number Diff line
@@ -3581,8 +3581,8 @@ with pkgs;
  bucklespring-libinput = callPackage ../applications/audio/bucklespring { };
  bucklespring-x11 = callPackage ../applications/audio/bucklespring { legacy = true; };
  inherit (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot {})
    buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker;
  buildbotPackages = recurseIntoAttrs (python3.pkgs.callPackage ../development/tools/continuous-integration/buildbot { });
  inherit (buildbotPackages) buildbot buildbot-ui buildbot-full buildbot-plugins buildbot-worker;
  bunyan-rs = callPackage ../development/tools/bunyan-rs { };