third_party/nix: move overrides to toolchain-bundle derivation

We have multiple consumers of nixpkgs. The nix-shell for development
and our toolchain-bundle. To reduce the amount of applied overlays
in normal evaluation, we move all overrides/patches that are only
required for the toolchain bundle to its definition. Additionally
all small overrides get inlined as its actually more easy to read.
I also refactored the way the toolchain-bundle is constructed to make
it easier to extend.

Change-Id: If7daafb6de43d26a0b95d0248cfb8c573cc5bbbe
Reviewed-on: https://review.monogon.dev/c/monogon/+/4457
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
diff --git a/third_party/nix/default.nix b/third_party/nix/default.nix
index 726119e..f2650b3 100644
--- a/third_party/nix/default.nix
+++ b/third_party/nix/default.nix
@@ -1,27 +1,13 @@
-{ sources ? import ./sources.nix }:
+{ sources ? import ./sources.nix, overlays ? [ ], config ? { } }:
 let
   pkgs = import sources.nixpkgs
     {
-      overlays = [
+      overlays = overlays ++ [
         (self: super: {
-          qemu-minimal = import ./pkgs/qemu { pkgs = super; };
-          diffutils = import ./pkgs/diffutils { pkgs = super; };
-          util-linux-minimal = import ./pkgs/util-linux { pkgs = super; };
-          bazel-unwrapped = import ./pkgs/bazel { pkgs = super; };
-          perl = import ./pkgs/perl { pkgs = super; };
           bazel_8 = self.callPackage ./pkgs/bazel_8/package.nix { };
-          python3Minimal = import ./pkgs/python3 { pkgs = super; };
-          bison = import ./pkgs/bison { pkgs = super; };
-        })
-        (self: super: {
-          vde2 = super.vde2.overrideAttrs (oldAttrs: {
-            env.NIX_CFLAGS_COMPILE = (oldAttrs.NIX_CFLAGS_COMPILE or "") + " -Wno-error=int-conversion -Wno-error=implicit-function-declaration";
-          });
         })
       ];
-
-      config.replaceCrossStdenv = { buildPackages, baseStdenv }:
-        (buildPackages.withCFlags [ "-fPIC" ]) baseStdenv;
+      config = config;
     };
 in
 pkgs // {