summaryrefslogtreecommitdiff
path: root/Biz/Bild/Nixpkgs.nix
blob: ecf50b90b374279ee65ca566830dc3cbd728868e (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
34
35
36
37
38
39
40
41
42
43
44
45
46
let
  sources = import ./Sources.nix { sourcesFile = ./Sources.json; };

  config = {
    allowBroken = true;
    allowUnfree = true;
    cudaSupport = true;
  };

  system = __currentSystem;

in import sources.nixpkgs-stable {
  inherit system config;
  overlays = [
    (_: _: { inherit sources; })
    (_: _: {
      unstable = import sources.nixpkgs-unstable { inherit system config; };
    })
    (_: pkgs: {
      # Given a generic `builder`, will generate an attrset for all the packages
      # pinned by `deps` with `builder` applied to the package. This attrset can
      # then be merged with the rest of the packages in the set as part of an
      # overlay or overrides.
      overridePinnedDeps = builder:
        pkgs.lib.genAttrs (builtins.attrNames pkgs.sources) builder;
    })
    (_: pkgs: {
      # 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:
        pkgs.${depName}.overrideAttrs (old:
          old // rec {
            version =
              pkgs.sources.${depName}.version or pkgs.sources.${depName}.rev;
            src = pkgs.sources.${depName};
          });
    })
    (_: pkgs:
      # override pinned deps with our sources
      pkgs.overridePinnedDeps pkgs.overrideSource)
    (import ./Deps.nix)
    (_: pkgs: { niv = import pkgs.sources.niv { }; })
  ];
}