on iko/ghcjs-patch-master help sign in
Expose our nixpkgs pins by restructuring default.nix (#514)

* Remove unused (and broken) test files * Make default.nix expose pinned nixpkgs Also make `nixpkgs/default.nix` just an attribute set of sources. This is simpler, and consistent with what e.g. `niv` does. * Add backwards compatibility shim, and version argument to allow evolution in future * Fix some missed things * Fix and improve quickstart

commiteb15db0450f7f70723934d9f5366b2d33be35b46 authorMichael Peyton Jones <michael.peyton-jones@iohk.io> dateTue 31 Mar 2020, 02:12 (7 years ago) parentb4823ea
31 files changed+203−174
README.org+27−9 build.nix+7−5 builder/default.nix+1−1 ci-lib.nix+1−1 ci.nix+8−7 default.nix+24−5 docs/user-guide.md+9−9 docs/user-guide/cabal-projects.md+2−2 docs/user-guide/development.md+4−4 docs/user-guide/materialization.md+63−42 docs/user-guide/projects.md+1−1 docs/user-guide/stack-projects.md+2−2 examples/cardano-sl-mingw32.nix+3−3 examples/cardano-sl.nix+3−3 examples/cardano-wallet-ghcjs.nix+4−3 examples/cardano-wallet-mingw32.nix+3−3 examples/cardano-wallet-rpi.nix+4−3 examples/cardano-wallet.nix+3−3 examples/plutus-mingw32.nix+3−3 examples/plutus.nix+3−3 nix-tools/regenerate.nix+5−2 nixpkgs/default.nix+6−2 release.nix+1−1 shell.nix+2−1 test-ghcjs.nix−12 test-mingw32.nix−12 test-rpi.nix−12 test.nix−12 test/default.nix+6−3 test/fully-static/cross.nix+2−2 test/regen.nix+6−3
README.org+27−9
@@ -20,13 +20,26 @@ For the documentation, see https://input-output-hk.github.io/haskell.nix/.
2020For =cabal.project= project add a =default.nix=:
2121
2222#+begin_src sh
23−{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
23+let
24+ # Fetch the latest haskell.nix and import its default.nix
25+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
26+ # haskell.nix provides access to the nixpkgs pins which are used by our CI, hence
27+ # you will be more likely to get cache hits when using these.
28+ # But you can also just use your own, e.g. '<nixpkgs>'
29+ nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
30+ # haskell.nix provides some arguments to be passed to nixpkgs, including some patches
31+ # and also the haskell.nix functionality itself as an overlay.
32+ nixpkgsArgs = haskellNix.nixpkgsArgs;
33+in
34+{ pkgs ? import nixpkgsSrc nixpkgsArgs
2435, haskellCompiler ? "ghc865"
2536}:
26− pkgs.haskell-nix.cabalProject {
27− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
28− ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
29− }
37+# 'cabalProject' generates a package set based on a cabal.project (and the corresponding .cabal files)
38+pkgs.haskell-nix.cabalProject {
39+ # 'cleanGit' cleans a source directory based on the files known by git
40+ src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
41+ ghc = pkgs.buildPackages.pkgs.haskell-nix.compiler.${haskellCompiler};
42+}
3043#+end_src
3144
3245Note that you'll need to add a comment specifying the expected sha256
@@ -45,11 +58,16 @@ source-repository-package
4558For a =stack.yaml= project add a =default.nix=:
4659
4760#+begin_src sh
48−{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
61+let
62+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
63+ nixpkgsSrc = haskellNix.sources.nixpkgs-1909;
64+ nixpkgsArgs = haskellNix.nixpkgsArgs;
65+in
66+{ pkgs ? import nixpkgsSrc nixpkgsArgs
4967}:
50− pkgs.haskell-nix.stackProject {
51− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
52− }
68+pkgs.haskell-nix.stackProject {
69+ src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
70+}
5371#+end_src
5472
5573To build the library component of a package in the project run:
build.nix+7−5
@@ -2,10 +2,12 @@
22#
33# It is separate from default.nix because that file is the public API
44# of Haskell.nix, which shouldn't have tests, etc.
5−
6−{ nixpkgs ? (import ./nixpkgs/default.nix)
7−, nixpkgsArgs ? (import ./default.nix)
8−, pkgs ? (nixpkgs nixpkgsArgs)
5+let
6+ haskellNix = (import ./default.nix {});
7+in
8+{ nixpkgs ? haskellNix.sources.nixpkgs-default
9+, nixpkgsArgs ? haskellNix.nixpkgsArgs
10+, pkgs ? import nixpkgs nixpkgsArgs
911, ifdLevel ? 1000
1012}:
1113
@@ -27,7 +29,7 @@ in rec {
2729 # nixpkgs 19.09 changes "Option has no description" from an
2830 # error into a warning. That is quite helpful when hardly any
2931 # of our options are documented, thanks @oxij.
30− pkgs = import ./nixpkgs { nixpkgs-pin = "release-19.09"; };
32+ pkgs = import (import ./nixpkgs/default.nix).nixpkgs-1909 {};
3133 };
3234 };
3335 # Because this is going to be used to test caching on hydra, it must not
builder/default.nix+1−1
@@ -40,7 +40,7 @@ let
4040
4141 hoogleLocal = let
4242 # Use the latest default nixpkgs hoogle.nix, as the 19.03 one does not work with cross compilers
43− nixpkgsHoogleLocal = import ((import ../nixpkgs {}).path + /pkgs/development/haskell-modules/hoogle.nix);
43+ nixpkgsHoogleLocal = import ((import (import ../nixpkgs).nixpkgs-default {}).path + /pkgs/development/haskell-modules/hoogle.nix);
4444 in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.haskellPackages.hoogle.components.exes.hoogle }:
4545 haskellLib.weakCallPackage pkgs nixpkgsHoogleLocal {
4646 # For musl we can use haddock from the buildGHC
ci-lib.nix+1−1
@@ -1,6 +1,6 @@
11let
22 # Generic nixpkgs, use *only* for lib functions that are stable across versions
3− pkgs = import ./nixpkgs/default.nix {};
3+ pkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {};
44 lib = pkgs.lib;
55in rec {
66 inherit (import ./dimension.nix) dimension;
ci.nix+8−7
@@ -6,9 +6,10 @@
66, restrictEval ? false }:
77let
88 inherit (import ./ci-lib.nix) dimension platformFilterGeneric filterAttrsOnlyRecursive;
9+ inherit (import ./default.nix {}) sources nixpkgsArgs;
910 nixpkgsVersions = {
10− "R1903" = "release-19.03";
11− "R1909" = "release-19.09";
11+ "R1903" = "nixpkgs-1903";
12+ "R1909" = "nixpkgs-1909";
1213 };
1314 systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
1415 # I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
@@ -27,13 +28,13 @@ let
2728 # aarch64 cross only works on linux
2829 inherit (lib.systems.examples) musl64 aarch64-multiplatform;
2930 };
30− haskellNixArgs = import ./.;
3131in
3232dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
33− # We need this for generic nixpkgs stuff at the right version
34− let genericPkgs = import ./nixpkgs { inherit nixpkgs-pin; };
33+ let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
34+ # We need this for generic nixpkgs stuff at the right version
35+ genericPkgs = import pinnedNixpkgsSrc {};
3536 in dimension "System" (systems genericPkgs) (systemName: system:
36− let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system; });
37+ let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
3738 build = import ./build.nix { inherit pkgs ifdLevel; };
3839 platformFilter = platformFilterGeneric pkgs system;
3940 in filterAttrsOnlyRecursive (_: v: platformFilter v) {
@@ -49,7 +50,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
4950 //
5051 dimension "Cross system" (crossSystems nixpkgsName genericPkgs system) (crossSystemName: crossSystem:
5152 # Cross builds
52− let pkgs = import ./nixpkgs (haskellNixArgs // { inherit nixpkgs-pin system crossSystem; });
53+ let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
5354 build = import ./build.nix { inherit pkgs ifdLevel; };
5455 in pkgs.recurseIntoAttrs {
5556 hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello;
default.nix+24−5
@@ -1,5 +1,24 @@
1−# This default.nix is designed to be passed directly nixpkgs with something like:
2−# import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
3−{ config = import ./config.nix;
4− overlays = import ./overlays;
5−}
1+let haskellNix = rec {
2+ sources = {
3+ inherit (import ./nixpkgs/default.nix) nixpkgs-1903 nixpkgs-1909 nixpkgs-default;
4+ };
5+
6+ config = import ./config.nix;
7+ overlays = import ./overlays;
8+ nixpkgsArgs = { inherit overlays config; };
9+ };
10+
11+ haskellNixV1 = haskellNix.nixpkgsArgs;
12+ haskellNixV2 = haskellNix;
13+
14+ v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)";
15+# If no arguments, then you get V1
16+# I'd like to make importing directly issue a warning, but I couldn't figure out a way to make it happen
17+in haskellNixV1 // {
18+ __functor = _: { version ? 2 }:
19+ if version == 1
20+ then builtins.trace v1DeprecationMessage haskellNixV1
21+ else if version == 2
22+ then haskellNixV2
23+ else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version));
24+}
docs/user-guide.md+9−9
@@ -7,7 +7,7 @@
77To build a package, say [lens][], from a stackage snapshot, say [lts-13.28][],
88you could run
99```bash
10−nix build '(with import <nixpkgs> (import ./.); haskell-nix.snapshots."lts-13.28").lens.components.library'
10+nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; haskell-nix.snapshots."lts-13.28").lens.components.library'
1111```
1212which would build the [lens][] library component from the lens package as fixed
1313by the [lts-13.28][] stackage snapshot.
@@ -15,14 +15,14 @@ by the [lts-13.28][] stackage snapshot.
1515To build any package from hackage, say [lens][], in version, say 4.17.1, you
1616could run
1717```bash
18−nix build '(with import <nixpkgs> (import ./.); (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; })).components.library'
18+nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; })).components.library'
1919```
2020which would build the [lens][] library component from the [lens-4.17.1][] package
2121from hackage. The dependencies would be solved against the most recent
2222[hackage-index-state][] that comes via the [hackage.nix][] pin with your
2323[haskell.nix][] checkout. A specific one can be specified as well:
2424```bash
25−nix build '(with import <nixpkgs> (import ./.); (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; index-state = "2019-07-14T00:00:00Z"; })).components.library'
25+nix build '(with import <nixpkgs> (import ./. {}).nixpkgsArgs; (haskell-nix.hackage-package { name = "lens"; version = "4.17.1"; index-state = "2019-07-14T00:00:00Z"; })).components.library'
2626```
2727which would use the hackage index as of `2019-07-14T00:00:00Z` to produce a build plan
2828for the [lens-4.17.1][] package.
@@ -49,7 +49,7 @@ produce derivations that we can `nix build`.
4949To build the latest `nix-tools` and store the result at `./nt`, run:
5050
5151```bash
52−nix build '(with import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)); haskell-nix.nix-tools)' --out-link nt
52+nix build '(with import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs; haskell-nix.nix-tools)' --out-link nt
5353```
5454
5555If you would like to then install `nix-tools` into your profile, run:
@@ -85,7 +85,7 @@ The easiest way to get a hold of [Haskell.nix][] is with
8585[`fetchTarball`](https://nixos.org/nix/manual/#ssec-builtins).
8686
8787```nix
88−import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
88+import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
8989```
9090
9191### Using your cabal.project file
@@ -93,7 +93,7 @@ import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-
9393If your project has a `cabal.project` you can add a `default.nix` like this:
9494
9595```nix
96−{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
96+{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
9797, haskellCompiler ? "ghc865"
9898}:
9999 pkgs.haskell-nix.cabalProject {
@@ -173,7 +173,7 @@ or one of the constraints in your local `.cabal` files).
173173If your project has a `stack.yaml` you can add a `default.nix` like this:
174174
175175```nix
176−{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz))
176+{ pkgs ? import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
177177}:
178178 pkgs.haskell-nix.stackProject {
179179 src = pkgs.haskell-nix.haskellLib.cleanGit { src = ./.; };
@@ -269,7 +269,7 @@ these Git repositories correspond to the actual Hackage and Stackage.
269269 stackageSourceJSON = ./stackage-src.json;
270270 };
271271 })]; })
272−, haskellNixArgs ? import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz)
272+, haskellNixArgs ? (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs
273273}:
274274 pkgs
275275```
@@ -283,7 +283,7 @@ attrsets and try examples.
283283# example.nix
284284{ nixpkgs ? <nixpkgs> }:
285285rec {
286− haskell = import nixpkgs (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz));
286+ haskell = import nixpkgs (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs;
287287 pkgNames = haskell.pkgs.lib.attrNames haskell.haskell-nix.snapshots."lts-13.18";
288288}
289289```
docs/user-guide/cabal-projects.md+2−2
@@ -81,8 +81,8 @@ instantiate a package set.
8181# default.nix
8282let
8383 # Import the Haskell.nix library,
84− src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
85− nixpkgs = import (src + "/nixpkgs") (import src);
84+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
85+ nixpkgs = haskellNix.sources.nixpgs-1909 haskellNix.nixpkgsArgs;
8686 haskell = nixpkgs.haskell-nix;
8787
8888 # Instantiate a package set using the generated file.
docs/user-guide/development.md+4−4
@@ -108,8 +108,8 @@ selects packages from the larger package set.
108108```nix
109109# shell.nix
110110let
111− src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
112− nixpkgs = import (src + "/nixpkgs") (import src);
111+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
112+ nixpkgs = haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
113113 haskell = nixpkgs.haskell-nix;
114114in
115115 haskell.haskellPackages.ghcWithPackages (ps: with ps;
@@ -127,8 +127,8 @@ project.
127127
128128```nix
129129let
130− src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
131− nixpkgs = import (src + "/nixpkgs") (import src);
130+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
131+ nixpkgs = haskellNix.sources.nixpkgs-1909 haskellNix.nixpkgsArgs;
132132 haskell = nixpkgs.haskell-nix;
133133in
134134 haskell.snapshots."lts-13.18".alex.components.exes.alex
docs/user-guide/materialization.md+63−42
@@ -39,10 +39,13 @@ Lets say we want to build `hlint`. We might start with an `hlint`
3939file that looks like this:
4040
4141```nix
42−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
43− name = "hlint";
44− version = "2.2.4";
45−}).components.exes.hlint
42+let inherit (import ./. {}) sources nixpkgsArgs;
43+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
44+ hlint = pkgs.haskell-nix.hackage-package {
45+ name = "hlint";
46+ version = "2.2.4";
47+ };
48+in hlint.components.exes.hlint
4649```
4750
4851Building this may result in a lot of output, but if you build
@@ -60,11 +63,14 @@ inputs. For `cabalProject` and `hackage-package` this means
6063we must specify the `index-state` of hackage we want to use:
6164
6265```nix
63−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
64− name = "hlint";
65− version = "2.2.4";
66− index-state = "2019-12-03T00:00:00Z";
67−}).components.exes.hlint
66+let inherit (import ./. {}) sources nixpkgsArgs;
67+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
68+ hlint = pkgs.haskell-nix.hackage-package {
69+ name = "hlint";
70+ version = "2.2.4";
71+ index-state = "2019-12-03T00:00:00Z";
72+ };
73+in hlint.components.exes.hlint
6874```
6975
7076Now if we build again we get a hint telling use how to
@@ -85,12 +91,15 @@ We can add the hash as `plan-sha256` or (`stack-sha256` for
8591`stackProject`)
8692
8793```nix
88−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
89− name = "hlint";
90− version = "2.2.4";
91− index-state = "2019-12-03T00:00:00Z";
92− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
93−}).components.exes.hlint
94+let inherit (import ./. {}) sources nixpkgsArgs;
95+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
96+ hlint = pkgs.haskell-nix.hackage-package {
97+ name = "hlint";
98+ version = "2.2.4";
99+ index-state = "2019-12-03T00:00:00Z";
100+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
101+ };
102+in hlint.components.exes.hlint
94103```
95104
96105Just adding the hash might help reuse of the cached nix, but nix will
@@ -111,13 +120,16 @@ trace: To materialize, point `materialized` to a copy of /nix/store/0xalcphb7ifv
111120To capture the nix we can do something like:
112121
113122```nix
114−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
115− name = "hlint";
116− version = "2.2.4";
117− index-state = "2019-12-03T00:00:00Z";
118− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
119− materialized = ./hlint.materialized;
120−}).components.exes.hlint
123+let inherit (import ./. {}) sources nixpkgsArgs;
124+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
125+ hlint = pkgs.haskell-nix.hackage-package {
126+ name = "hlint";
127+ version = "2.2.4";
128+ index-state = "2019-12-03T00:00:00Z";
129+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
130+ materialized = ./hlint.materialized;
131+ };
132+in hlint.components.exes.hlint
121133```
122134
123135Now we can copy the nix files needed and build with:
@@ -138,14 +150,17 @@ We can change `version` and temporarily add
138150`checkMaterialization = true;`:
139151
140152```nix
141−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
142− name = "hlint";
143− version = "2.2.3";
144− index-state = "2019-12-03T00:00:00Z";
145− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
146− materialized = ./hlint.materialized;
147− checkMaterialization = true;
148−}).components.exes.hlint
153+let inherit (import ./. {}) sources nixpkgsArgs;
154+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
155+ hlint = pkgs.haskell-nix.hackage-package {
156+ name = "hlint";
157+ version = "2.2.4";
158+ index-state = "2019-12-03T00:00:00Z";
159+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
160+ materialized = ./hlint.materialized;
161+ checkMaterialization = true;
162+ };
163+in hlint.components.exes.hlint
149164```
150165
151166This will fail and report the details of what is wrong:
@@ -213,11 +228,14 @@ hash and materialized nix we can find out what nix files should be.
213228For instance:
214229
215230```nix
216−(import ./nixpkgs (import ./.)).haskell-nix.hackage-project {
217− name = "hlint";
218− version = "2.2.4";
219− index-state = "2019-12-03T00:00:00Z";
220−}
231+let inherit (import ./. {}) sources nixpkgsArgs;
232+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
233+ hlint = pkgs.haskell-nix.hackage-project {
234+ name = "hlint";
235+ version = "2.2.4";
236+ index-state = "2019-12-03T00:00:00Z";
237+ };
238+in hlint
221239```
222240
223241```
@@ -242,13 +260,16 @@ Yes and it gives us the same speed improvement, however:
242260For instance:
243261
244262```nix
245−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
246− name = "hlint";
247− version = "2.2.4";
248− index-state = "2019-12-03T00:00:00Z";
249− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
250− materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
251−}).components.exes.hlint
263+let inherit (import ./. {}) sources nixpkgsArgs;
264+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
265+ hlint = pkgs.haskell-nix.hackage-package {
266+ name = "hlint";
267+ version = "2.2.4";
268+ index-state = "2019-12-03T00:00:00Z";
269+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
270+ materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
271+ };
272+in hlint.components.exes.hlint
252273```
253274
254275Running when no building is needed is still slow in restricted evaluation mode.
docs/user-guide/projects.md+1−1
@@ -22,7 +22,7 @@ expression (see the links bellow). The following file then produces a package se
2222# default.nix
2323let
2424 # Import the Haskell.nix library,
25− pkgs = import <nixpkgs> (import builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz);
25+ pkgs = import <nixpkgs> (import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {}).nixpkgsArgs;
2626
2727 # Import the file you will create in the stack-to-nix or cabal-to-nix step.
2828 my-pkgs = import ./pkgs.nix;
docs/user-guide/stack-projects.md+2−2
@@ -43,8 +43,8 @@ instantiate a package set.
4343# default.nix
4444let
4545 # Import the Haskell.nix library,
46− src = builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz;
47− nixpkgs = import (src + "/nixpkgs") (import src);
46+ haskellNix = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) {};
47+ nixpkgs = haskellNix.sources.nixpgs-1909 haskellNix.nixpkgsArgs;
4848 haskell = nixpkgs.haskell-nix;
4949
5050 # Instantiate a package set using the generated file.
examples/cardano-sl-mingw32.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
2−(haskell-nix.stackProject (import ./cardano-sl-args.nix))
3− .cardano-sl.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
3+in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all
examples/cardano-sl.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs (import ../.);
2−(haskell-nix.stackProject (import ./cardano-sl-args.nix))
3− .cardano-sl.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
3+in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all
examples/cardano-wallet-ghcjs.nix+4−3
@@ -1,5 +1,6 @@
1−with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "js-unknown-ghcjs"; });
3+ Cabal = pkgs.buildPackages.haskell-nix.hackage-package {
34 name = "Cabal"; version = "2.4.1.0";
45 modules = [
56 { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
@@ -11,7 +12,7 @@ let Cabal = buildPackages.haskell-nix.hackage-package {
1112# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
1213# ];}).cardano-wallet.components.all
1314(let stack-pkgs = import ../cardano-wallet/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15+ in let pkg-set = pkgs.haskell-nix.mkStackPkgSet
1516 { inherit stack-pkgs;
1617 pkg-def-extras = [(hackage: {
1718 packages = {
examples/cardano-wallet-mingw32.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
2−(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
3− .cardano-wallet.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
3+in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all
examples/cardano-wallet-rpi.nix+4−3
@@ -1,5 +1,6 @@
1−with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "armv6l-unknown-linux-gnueabihf"; }; }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "armv6l-unknown-linux-gnueabihf"; });
3+ Cabal = pkgs.buildPackages.haskell-nix.hackage-package {
34 name = "Cabal"; version = "2.4.1.0";
45 modules = [
56 { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
@@ -11,7 +12,7 @@ let Cabal = buildPackages.haskell-nix.hackage-package {
1112# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
1213# ];}).cardano-wallet.components.all
1314(let stack-pkgs = import ../cardano-wallet/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15+ in let pkg-set = pkgs.haskell-nix.mkStackPkgSet
1516 { inherit stack-pkgs;
1617 pkg-def-extras = [(hackage: {
1718 packages = {
examples/cardano-wallet.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs (import ../.);
2−(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
3− .cardano-wallet.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
3+in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all
examples/plutus-mingw32.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs ((import ../.) // { crossSystem.config = "x86_64-pc-mingw32"; });
2−(haskell-nix.stackProject (import ./plutus-args.nix))
3− .language-plutus-core.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; });
3+in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all
examples/plutus.nix+3−3
@@ -1,3 +1,3 @@
1−with import ../nixpkgs (import ../.);
2−(haskell-nix.stackProject (import ./plutus-args.nix))
3− .language-plutus-core.components.all
1+let inherit (import ../. {}) sources nixpkgsArgs;
2+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
3+in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all
nix-tools/regenerate.nix+5−2
@@ -6,8 +6,11 @@
66# 3. run `./result/bin/update-nix-tools` and follow the instructions.
77# 4. git commit -a -m "bump nix-tools"
88#
9+let
10+ inherit (import ../default.nix {}) sources nixpkgsArgs;
11+in
912{ specJSON ? ./nix-tools-src.json }:
10−with import ../nixpkgs (import ../.);
13+with import sources.nixpkgs-default nixpkgsArgs;
1114let
1215 src = haskell-nix.cleanSourceHaskell {
1316 src = haskell-nix.fetchExternal {
@@ -65,4 +68,4 @@ writeShellScriptBin "update-nix-tools" ''
6568 echo "*** cp -fr "$TMP/" ."
6669 echo "***"
6770 echo "******"
68−''
71+''
nixpkgs/default.nix+6−2
@@ -1,5 +1,4 @@
11# see ../docs/dev/nixpkgs-pin.md
2−{ nixpkgs-pin ? "github", ... }@args:
32let
43 fetch = jsonFile:
54 with builtins;
@@ -9,4 +8,9 @@ let
98 inherit (spec) sha256;
109 url = "${spec.url}/archive/${spec.rev}.tar.gz";
1110 };
12−in import (fetch (./. + "/${nixpkgs-pin}.json")) (builtins.removeAttrs args [ "nixpkgs-pin" ])
11+in
12+{
13+ nixpkgs-1909 = fetch (./. + "/release-19.09.json");
14+ nixpkgs-1903 = fetch (./. + "/release-19.03.json");
15+ nixpkgs-default = fetch (./. + "/github.json");
16+}
release.nix+1−1
@@ -5,7 +5,7 @@
55
66let
77 inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations;
8− genericPkgs = import ./nixpkgs {};
8+ genericPkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {};
99 lib = genericPkgs.lib;
1010 ci = import ./ci.nix { inherit supportedSystems ifdLevel; restrictEval = true; };
1111 allJobs = stripAttrsForHydra (filterDerivations ci);
shell.nix+2−1
@@ -1,5 +1,6 @@
11let
2− pkgs = import ./nixpkgs/default.nix (import ./default.nix);
2+ inherit (import ./default.nix {}) sources nixpkgsArgs;
3+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
34in pkgs.stdenv.mkDerivation rec {
45 name = "env";
56 env = pkgs.buildEnv { name = name; paths = buildInputs; };
test-ghcjs.nixdeleted−12
@@ -1,12 +0,0 @@
1−with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
3− name = "Cabal"; version = "2.4.1.0";
4− modules = [
5− { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
6− ];
7−}; in
8−(haskell-nix.hackage-package {
9− name = "hello"; version = "1.0.0.2";
10− modules = [
11− ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12− ];}).components.exes.hello
test-mingw32.nixdeleted−12
@@ -1,12 +0,0 @@
1−with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "x86_64-pc-mingw32"; }; }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
3− name = "Cabal"; version = "2.4.1.0";
4− modules = [
5− { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
6− ];
7−}; in
8−(haskell-nix.hackage-package {
9− name = "hello"; version = "1.0.0.2";
10− modules = [
11− ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12− ];}).components.exes.hello
test-rpi.nixdeleted−12
@@ -1,12 +0,0 @@
1−with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "armv6l-unknown-linux-gnueabihf"; }; }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
3− name = "Cabal"; version = "2.4.1.0";
4− modules = [
5− { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
6− ];
7−}; in
8−(haskell-nix.hackage-package {
9− name = "hello"; version = "1.0.0.2";
10− modules = [
11− ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12− ];}).components.exes.hello
test.nixdeleted−12
@@ -1,12 +0,0 @@
1−with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { }; };
2−let Cabal = buildPackages.haskell-nix.hackage-package {
3− name = "Cabal"; version = "2.4.1.0";
4− modules = [
5− { packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
6− ];
7−}; in
8−(haskell-nix.hackage-package {
9− name = "hello"; version = "1.0.0.2";
10− modules = [
11− ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12− ];}).components.exes.hello
test/default.nix+6−3
@@ -1,6 +1,9 @@
1−{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
2−, nixpkgs ? ../nixpkgs
3−, nixpkgsArgs ? { }
1+let
2+ haskellNix = (import ../default.nix {});
3+in
4+{ pkgs ? import nixpkgs nixpkgsArgs
5+, nixpkgs ? haskellNix.sources.nixpkgs-default
6+, nixpkgsArgs ? haskellNix.nixpkgsArgs
47, ifdLevel ? 1000
58}:
69
test/fully-static/cross.nix+2−2
@@ -1,10 +1,10 @@
11{ pkgs ? import nixpkgs { }
2−, nixpkgs ? ../../nixpkgs
2+, nixpkgs ? import (../../nixpkgs).nixpkgs-default
33}:
44
55let
66 pkgs' = pkgs.pkgsCross.musl64;
7− haskellMusl64 = pkgs.callPackage ../../. { pkgs = pkgs'; };
7+ haskellMusl64 = pkgs.callPackage ../.. { pkgs = pkgs'; };
88
99 test = haskellMusl64.callPackage ./default.nix {
1010 inherit (pkgs') buildPackages;
test/regen.nix+6−3
@@ -1,7 +1,10 @@
11# A script for regenerating nix for tests
2−{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
3−, nixpkgs ? ../nixpkgs
4−, nixpkgsArgs ? { }
2+let
3+ haskellNix = (import ../default.nix {});
4+in
5+{ pkgs ? import nixpkgs nixpkgsArgs
6+, nixpkgs ? haskellNix.sources.nixpkgs-default
7+, nixpkgsArgs ? haskellNix.nixpkgsArgs
58}:
69
710with pkgs;