summaryrefslogtreecommitdiff
path: root/Biz/Bild/Nixpkgs.nix
blob: 659443cfe41c7fa399b05763a47afe0ee5c1b3dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let
  sources = import ./Sources.nix;
in
import sources.nixpkgs {
  system = __currentSystem;
  overlays = [
    (_: _: { inherit sources; })
    (_: pkgs: rec {
      pinnedDeps = builtins.attrNames
        (builtins.removeAttrs pkgs.sources ["__functor"]);

      overridePinnedDeps = builder: pkgs.lib.genAttrs pinnedDeps builder;

      # Modifies a derivation with our source and version, keeping old build
      # rules. This will fail if build steps have changed, or if no build
      # rules are available upstream..
      overrideSource = depName:
        if pkgs ? depName then
          pkgs.${depName}.overrideAttrs (old: old // rec {
            name = "${depName}-${version}";
            version = pkgs.sources.${depName}.version or pkgs.sources.${depName}.rev;
            src = pkgs.sources.${depName};
          })
        else abort "pkg ${depName} not available";
    })
    (_: pkgs: pkgs.overridePinnedDeps pkgs.overrideSource)
    (import ./Deps.nix)
    (_: pkgs: { niv = import pkgs.sources.niv {}; })
  ];
  config = {
    allowBroken = true;
  };
}