@@ -39,10 +39,13 @@ Lets say we want to build `hlint`. We might start with an `hlint`
39file that looks like this:
39file that looks like this:
42+let inherit (import ./. {}) sources nixpkgsArgs;
43+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
42−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
44+ hlint = pkgs.haskell-nix.hackage-package {
43− name = "hlint";
45+ name = "hlint";
44− version = "2.2.4";
46+ version = "2.2.4";
45−}).components.exes.hlint
48+in hlint.components.exes.hlint
48Building this may result in a lot of output, but if you build
51Building this may result in a lot of output, but if you build
@@ -60,11 +63,14 @@ inputs. For `cabalProject` and `hackage-package` this means
60we must specify the `index-state` of hackage we want to use:
63we must specify the `index-state` of hackage we want to use:
66+let inherit (import ./. {}) sources nixpkgsArgs;
67+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
63−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
68+ hlint = pkgs.haskell-nix.hackage-package {
64− name = "hlint";
69+ name = "hlint";
65− version = "2.2.4";
70+ version = "2.2.4";
66− index-state = "2019-12-03T00:00:00Z";
71+ index-state = "2019-12-03T00:00:00Z";
67−}).components.exes.hlint
73+in hlint.components.exes.hlint
70Now if we build again we get a hint telling use how to
76Now 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
85`stackProject`)
91`stackProject`)
94+let inherit (import ./. {}) sources nixpkgsArgs;
95+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
88−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
96+ hlint = pkgs.haskell-nix.hackage-package {
89− name = "hlint";
97+ name = "hlint";
90− version = "2.2.4";
98+ version = "2.2.4";
91− index-state = "2019-12-03T00:00:00Z";
99+ index-state = "2019-12-03T00:00:00Z";
92− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
100+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
93−}).components.exes.hlint
102+in hlint.components.exes.hlint
96Just adding the hash might help reuse of the cached nix, but nix will
105Just 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
111To capture the nix we can do something like:
120To capture the nix we can do something like:
123+let inherit (import ./. {}) sources nixpkgsArgs;
124+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
114−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
125+ hlint = pkgs.haskell-nix.hackage-package {
115− name = "hlint";
126+ name = "hlint";
116− version = "2.2.4";
127+ version = "2.2.4";
117− index-state = "2019-12-03T00:00:00Z";
128+ index-state = "2019-12-03T00:00:00Z";
118− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
129+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
119− materialized = ./hlint.materialized;
130+ materialized = ./hlint.materialized;
120−}).components.exes.hlint
132+in hlint.components.exes.hlint
123Now we can copy the nix files needed and build with:
135Now we can copy the nix files needed and build with:
@@ -138,14 +150,17 @@ We can change `version` and temporarily add
138`checkMaterialization = true;`:
150`checkMaterialization = true;`:
153+let inherit (import ./. {}) sources nixpkgsArgs;
154+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
141−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
155+ hlint = pkgs.haskell-nix.hackage-package {
142− name = "hlint";
156+ name = "hlint";
143− version = "2.2.3";
157+ version = "2.2.4";
144− index-state = "2019-12-03T00:00:00Z";
158+ index-state = "2019-12-03T00:00:00Z";
145− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
159+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
146− materialized = ./hlint.materialized;
160+ materialized = ./hlint.materialized;
147− checkMaterialization = true;
161+ checkMaterialization = true;
148−}).components.exes.hlint
163+in hlint.components.exes.hlint
151This will fail and report the details of what is wrong:
166This 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.
213For instance:
228For instance:
231+let inherit (import ./. {}) sources nixpkgsArgs;
232+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
216−(import ./nixpkgs (import ./.)).haskell-nix.hackage-project {
233+ hlint = pkgs.haskell-nix.hackage-project {
217− name = "hlint";
234+ name = "hlint";
218− version = "2.2.4";
235+ version = "2.2.4";
219− index-state = "2019-12-03T00:00:00Z";
236+ index-state = "2019-12-03T00:00:00Z";
@@ -242,13 +260,16 @@ Yes and it gives us the same speed improvement, however:
242For instance:
260For instance:
263+let inherit (import ./. {}) sources nixpkgsArgs;
264+ pkgs = import sources.nixpkgs-default nixpkgsArgs;
245−((import ./nixpkgs (import ./.)).haskell-nix.hackage-package {
265+ hlint = pkgs.haskell-nix.hackage-package {
246− name = "hlint";
266+ name = "hlint";
247− version = "2.2.4";
267+ version = "2.2.4";
248− index-state = "2019-12-03T00:00:00Z";
268+ index-state = "2019-12-03T00:00:00Z";
249− plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
269+ plan-sha256 = "1a4rhv3h2daz6dzwzfl3w7l1v556n7aqfiagw6m0rvqq230iabss";
250− materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
270+ materialized = /nix/store/qk1fvza1alkvs51vzmpjp2xsg8xklyxk-hlint-plan-to-nix-pkgs;
251−}).components.exes.hlint
272+in hlint.components.exes.hlint
254Running when no building is needed is still slow in restricted evaluation mode.
275Running when no building is needed is still slow in restricted evaluation mode.