1{ pkgs ? import <nixpkgs> {}
3# You can provide different pins for hackage.nix and stackage.nix if required.
4# It's also possible to override these sources with NIX_PATH.
5, hackageSourceJSON ? ./hackage-src.json
6, stackageSourceJSON ? ./stackage-src.json
10 # pkg-def's may reference boot packages, but those
11 # are not guaranteed to be available on hackage, as
12 # it is a manual process. They might eventually show
13 # up much later on hackage; but are not installable
14 # anyway. Therefore we just strip them out of the
16 boot-pkgs = [ "rts" "ghc" "ghci" "ghc-boot" "ghc-boot-th"
17 "ghc-heap" # since ghc 8.6.
19 strip-pkg-def = pkgs: pkg-def: hackage: with pkgs.lib;
20 mapAttrs (k: v: if k == "packages"
21 then filterAttrs (k: _: !(builtins.elem k boot-pkgs)) v
25 # ghc hackage patches.
26 # these are patches that turn hackage packages into the same as the ones
27 # ghc ships with the supposedly same version. See GHC Track Issue: 16199
28 ghcHackagePatches = import ./patches;
30 compat = import ./lib/compat.nix;
32 # Utility function for downloading a pinned git repo, that can be
33 # overridden with NIX_PATH.
34 fetchExternal = import ./lib/fetch-external.nix;
36 # All packages from Hackage as Nix expressions
37 hackage = import (fetchExternal {
38 name = "hackage-exprs-source";
39 specJSON = hackageSourceJSON;
43 # The set of all Stackage snapshots
44 stackage = import (fetchExternal {
45 name = "stackage-snapshot-source";
46 specJSON = stackageSourceJSON;
47 override = "stackage";
51 # Utility functions for working with the component builder.
52 haskellLib = let hl = import ./lib { inherit (pkgs) lib; haskellLib = hl; }; in hl;
54 # Create a Haskell package set based on a cabal build plan (plan-to-nix)
55 # and Nix expressions representing cabal packages (cabal-to-nix).
57 { pkg-def # Base package set. Either from stackage (via stack-to-nix) or from a cabal projects plan file (via plan-to-nix)
58 , pkg-def-overlays ? [] # Additional packages to augment the Base package set `pkg-def` with.
62 import ./package-set.nix (args // {
64 pkg-def = strip-pkg-def pkgs pkg-def;
67 # Create a Haskell package set based on a Stack configuration.
69 { stack-pkgs # Path to the output of stack-to-nix
70 , pkg-def-overlays ? []
75 # The Stackage release referenced in the stack config
76 pkg-def = stackage.${stack-pkgs.resolver};
77 # The compiler referenced in the stack config
78 compiler = (stack-pkgs.overlay hackage).compiler or (pkg-def hackage).compiler;
81 pkg-def-overlays = [ stack-pkgs.overlay ] ++ pkg-def-overlays;
82 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
85 # Create a Haskell package set based on a Cabal configuration.
86 mkCabalProjectPkgSet =
87 { plan-pkgs # Path to the output of plan-to-nix
88 , pkg-def-overlays ? []
93 pkg-def = plan-pkgs.pkgs;
94 # The compiler referenced in the stack config
95 compiler = (plan-pkgs.overlay hackage).compiler or (pkg-def hackage).compiler;
98 pkg-def-overlays = [ plan-pkgs.overlay ] ++ pkg-def-overlays;
99 modules = [ ghcHackagePatches.${compiler.nix-name} ] ++ modules;
102 # Programs for generating Nix expressions from Cabal and Stack
104 nix-tools = self.callPackage ./nix-tools {
105 inherit fetchExternal;
108 # Snapshots of Hackage and Stackage, converted to Nix expressions,
110 inherit hackage stackage;
112 # Scripts for keeping Hackage and Stackage up to date.
113 maintainer-scripts = {
114 update-hackage = self.callPackage ./scripts/update-hackage.nix {};
115 update-stackage = self.callPackage ./scripts/update-stackage.nix {};
120 pkgs.lib.makeScope pkgs.newScope packages
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list