on iko/ghcjs-patch-master help sign in
Reorg cardano/plutus examples. Move mkCacheModule (#265)
39739d9Hamish Mackenzie
@@ -57,292 +57,9 @@ in
57 # x86_64-darwin = (import ./test { nixpkgs = nixpkgsSrc; nixpkgsArgs = { system = "x86_64-darwin"; }; });
57 # x86_64-darwin = (import ./test { nixpkgs = nixpkgsSrc; nixpkgsArgs = { system = "x86_64-darwin"; }; });
58 };
58 };
59 examples = let
59 examples = let
60− iohk-archive = name: hash: "https://github.com/input-output-hk/${name}/archive/${hash}.tar.gz";
60+ cardano-sl-args = import ./examples/cardano-sl-args.nix;
61− mkCacheModule = cache:
61+ cardano-wallet-args = import ./examples/cardano-wallet-args.nix;
62− # for each item in the `cache`, set
62+ plutus-args = import ./examples/plutus-args.nix;
63− # packages.$name.src = fetchgit ...
64− # and
65− # packages.$name.postUnpack = ...
66− # if subdir is given.
67− #
68− # We need to do this, as cabal-to-nix will generate
69− # src = /nix/store/... paths, and when we build the
70− # package we won't have access to the /nix/store
71− # path. As such we regenerate the fetchgit command
72− # we used in the first place, and thus have a proper
73− # src value.
74− #
75− # TODO: this should be moved into `call-stack-to-nix`
76− # it should be automatic and not the burden of
77− # the end user to work around nix peculiarities.
78− { packages = builtins.foldl' (x: y: x // y) {}
79− (builtins.map ({ name, url, rev, sha256, subdir ? null, ... }:
80− { ${name} = { src = fetchgit { inherit url rev sha256; }; }
81− // lib.optionalAttrs (subdir != null) { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
82− }) cache);
83− };
84− cardano-sl-args = rec {
85− src = builtins.fetchTarball (iohk-archive "cardano-sl" "1a792d7cd0f0c93a0f0c28f66372bce3c3808dbd");
86− pkgs = [
87− "cardano-sl-crypto-test"
88− "cardano-sl-crypto"
89− "cardano-sl-cluster"
90− "cardano-sl-infra"
91− "cardano-sl-infra-test"
92− "cardano-sl-tools"
93− "cardano-sl-tools-post-mortem"
94− "cardano-sl-core"
95− "cardano-sl-core-test"
96− "cardano-sl-util-test"
97− "cardano-sl-util"
98− "cardano-sl-script-runner"
99− "cardano-sl-auxx"
100− "cardano-sl-networking"
101− "cardano-sl-explorer"
102− "cardano-sl-chain-test"
103− "cardano-sl-chain"
104− "cardano-sl-mnemonic"
105− "cardano-sl-generator"
106− "cardano-sl-x509"
107− "cardano-sl-utxo"
108− "cardano-sl-node-ipc"
109− "cardano-wallet"
110− "cardano-sl"
111− "cardano-sl-db-test"
112− "cardano-sl-db"
113− "cardano-sl-faucet"
114− "cardano-sl-binary-test"
115− "cardano-sl-binary"
116− "cardano-sl-node"
117− "cardano-sl-client"
118− ];
119− cache = [
120− { name = "cardano-crypto";
121− url = "https://github.com/input-output-hk/cardano-crypto";
122− rev = "4590efa638397e952a51a8994b5543e4ea3c1ecd";
123− sha256 = "0hl2n3bba5v2j0lmxhs7hs01z3aznh2bwf9cb434icq2g0bl8ms3"; }
124− { name = "haskell-ip";
125− cabal-file = "ip.cabal";
126− url = "https://github.com/andrewthad/haskell-ip";
127− rev = "9bb453139aa82cc973125091800422a523e1eb8f";
128− sha256 = "199mfpbgca7rvwvwk2zsmcpibc0sk0ni7c5zlf4gk3cps8s85gyr"; }
129− { name = "time-units";
130− url = "https://github.com/serokell/time-units.git";
131− rev = "6c3747c1ac794f952de996dd7ba8a2f6d63bf132";
132− sha256 = "0psdr1if0rgnn24698x3583m0603rwd3sd7yb9whj03hskmkwpgs";
133− }
134− { name = "kademlia";
135− url = "https://github.com/serokell/kademlia.git";
136− rev = "7120bb4d28e708acd52dfd61d3dca7914fac7d7f";
137− sha256 = "1k1wp9dwhzzqfivxc28vhxfqplnyh916crr7bhsiv829d6qifhw1";
138− }
139− { name = "network-transport";
140− url = "https://github.com/serokell/network-transport";
141− rev = "018a50b9042c2115c3ec9c9fd5ca5f28737dd29c";
142− sha256 = "0lqa26l2ikpq6a4s7qm9b2favx59w82i0wngakhfyax66fpixp8q";
143− }
144− { name = "network-transport-tcp";
145− url = "https://github.com/avieth/network-transport-tcp";
146− rev = "2634e5e32178bb0456d800d133f8664321daa2ef";
147− sha256 = "03shp9prflhgqzw7pymw1pq2q7s1wf46pyjm2csx8646snrhf35i";
148− }
149− { name = "network-transport-inmemory";
150− url = "https://github.com/avieth/network-transport-inmemory";
151− rev = "5d8ff2b07b9df35cf61329a3d975e2c8cf95c12a";
152− sha256 = "0ak64rks3lk3kk5wyndrrk2swmd84h9diribzix305xwz1jhjj9w";
153− }
154− { name = "acid-state";
155− url = "https://github.com/parsonsmatt/acid-state";
156− rev = "a1b23e2056f134e53f705a694ab85deeecabec5c";
157− sha256 = "0mgdk8252g7wbb0afyn21pcn3bwh4vainy3h2d0xsv4hlpgqgnw8";
158− }
159− { name = "socket-io";
160− url = "https://github.com/input-output-hk/engine.io";
161− rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
162− sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
163− subdir = "socket-io";
164− }
165− { name = "engine-io";
166− url = "https://github.com/input-output-hk/engine.io";
167− rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
168− sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
169− subdir = "engine-io";
170− }
171− { name = "engine-io-wai";
172− url = "https://github.com/input-output-hk/engine.io";
173− rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
174− sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
175− subdir = "engine-io-wai";
176− }
177− { name = "canonical-json";
178− url = "https://github.com/well-typed/canonical-json.git";
179− rev = "ddfe3593b80b5ceb88842bb7a6f2268df75d2c2f";
180− sha256 = "02fzn1xskis1lc1pkz0j92v6ipd89ww0k2p3dvwpm3yap5dpnm7k";
181− }
182− { name = "clock";
183− url = "https://github.com/corsis/clock.git";
184− rev = "ef60bd51a3587a173adf565c33bf2886df6e3842";
185− sha256 = "1r4n9imls483f7wd61fi1jk16z2k7w36gpx798sqidvwbnc831q1";
186− }
187− { name = "rocksdb-haskell-ng";
188− url = "https://github.com/input-output-hk/rocksdb-haskell-ng.git";
189− rev = "49f501a082d745f3b880677220a29cafaa181452";
190− sha256 = "02jvri8ik8jgrxwa6qmh3xcwqvm4s27iv3sxpjpny79nlhlxvfzp";
191− }
192− { name = "log-warper";
193− url = "https://github.com/input-output-hk/log-warper";
194− rev = "5271ab6c33541b8155ca203e714875974ec116be";
195− sha256 = "1h14004a8iwr8nw31pqq6kfdhfsyzzl8a50hrmj2acjqq6mbdl2m";
196− }
197− { name = "universum";
198− url = "https://github.com/input-output-hk/universum";
199− rev = "15f7db758ff5a24b874de2247f6f7a4576562da5";
200− sha256 = "127bs29zpjcc40777dv7figk05gd00b9ja57sp11w440qr5h72hk";
201− }
202− { name = "serokell-util";
203− url = "https://github.com/input-output-hk/serokell-util";
204− rev = "457f1d149c6e238841f283a1faf7bc8fb021b27d";
205− sha256 = "0llbryqna9p03db3ka4933vzf4jw1yxdbsf7cqi2pivsy1vp6kp0";
206− }
207− { name = "inspector";
208− url = "https://github.com/primetype/inspector.git";
209− rev = "c975f4329365f0379c04358138e616fb96fb0b79";
210− sha256 = "12q1v7a8kcw7qi4lws4j3mvxwfkhni6zmp870kmnkgbgwvrax9gs";
211− }
212− ];
213− # This is needed due to some deficiencies in stackage snapshots.
214− # maybe we should make this part of some `stack-default-pkg-def-extras`?
215− # We have similar logic in the snapshots.nix file to deal with this in
216− # snapshots.
217− #
218− # TODO: move this somewhere into stackProject
219− pkg-def-extras = [
220− (hackage: {
221− packages = {
222− "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
223− "process" = (((hackage.process)."1.6.5.0").revisions).default;
224− };
225− })
226− (hackage: {
227− packages = {
228− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
229− };
230− })
231− ];
232− modules = [ (mkCacheModule cache) ];
233− };
234− cardano-wallet-args = rec {
235− src = builtins.fetchTarball (iohk-archive "cardano-wallet" "d525e85fe19a37d8b5648ac783ef35474be38bcc");
236− pkgs = [
237− "bech32"
238− "text-class"
239− "cardano-wallet-http-bridge"
240− "cardano-wallet-launcher"
241− "cardano-wallet-test-utils"
242− "cardano-wallet-core"
243− "cardano-wallet-jormungandr"
244− "cardano-wallet-cli"
245− "cardano-crypto"
246− "cardano-wallet-core-integration"
247− ];
248− # wee need these, as they are referenced in the stack.yaml file; however we can't
249− # fetch them at IFD time as they don't provide the sha256. Hence we use the cache-file
250− # facility on stack-to-nix and pre-populate the cache file with the relevant hashes.
251− cache = [
252− { name = "cardano-crypto";
253− url = "https://github.com/input-output-hk/cardano-crypto";
254− rev = "3c5db489c71a4d70ee43f5f9b979fcde3c797f2a";
255− sha256 = "0lss4x41m0ylhximqjc56ps0y3pag3x58wm480pzfa48lpk4gqpk"; }
256− { name = "persistent-sqlite";
257− url = "https://github.com/KtorZ/persistent";
258− rev = "79f2ece07eafae005a703c8eda1bd2420b5e07b5";
259− sha256 = "081bhdg52wn7vgxsgl4aimy73ccai05j64r24hwkdnjj4kz96lia";
260− subdir = "persistent-sqlite"; }
261− { name = "iohk-monitoring";
262− url = "https://github.com/input-output-hk/iohk-monitoring-framework";
263− rev = "bd31cd2f3922010ddb76bb869f29c4e63bb8001b";
264− subdir = "iohk-monitoring";
265− sha256 = "1dfk505qbpk6p3gcpxa31wmg98qvx9hlrxlf0khaj7hizf3b8b60"; }
266− { name = "contra-tracer";
267− url = "https://github.com/input-output-hk/iohk-monitoring-framework";
268− rev = "bd31cd2f3922010ddb76bb869f29c4e63bb8001b";
269− subdir = "contra-tracer";
270− sha256 = "1dfk505qbpk6p3gcpxa31wmg98qvx9hlrxlf0khaj7hizf3b8b60"; }
271− ];
272− # This is needed due to some deficiencies in stackage snapshots.
273− # maybe we should make this part of some `stack-default-pkg-def-extras`?
274− # We have similar logic in the snapshots.nix file to deal with this in
275− # snapshots.
276− #
277− # TODO: move this somewhere into stackProject
278− pkg-def-extras = [
279− (hackage: {
280− packages = {
281− "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
282− "process" = (((hackage.process)."1.6.5.0").revisions).default;
283− };
284− })
285− (hackage: {
286− packages = {
287− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
288− };
289− })
290− ];
291− modules = [ (mkCacheModule cache) ];
292− };
293− plutus-args = rec {
294− src = builtins.fetchTarball (iohk-archive "plutus" "0d76e98ab267d621ad15002b5f824cad71797754");
295− cache = [
296− { name = "row-types";
297− url = "https://github.com/target/row-types";
298− rev = "1e8d5e084ffd46f6c7842826a1f62c60820885df";
299− sha256 = "0ly5m4r8wkm8gdqyrqzsjfmp189yxsd4qp0zi3idrbgfaf45sk9k"; }
300− { name = "purescript-bridge";
301− url = "https://github.com/shmish111/purescript-bridge.git";
302− rev = "0042602f8a195b1fe185138f9ccca02020b8dd62";
303− sha256 = "1vl88g41f4vvgw9iyn7zd7i52qshpnk02z0y6czg4zy7wk3q12gz"; }
304− { name = "servant-purescript";
305− url = "https://github.com/shmish111/servant-purescript.git";
306− rev = "ece5d1dad16a5731ac22040075615803796c7c21";
307− sha256 = "1axcbsaym64q67hvjc7b3izd48cgqwi734l7f7m22jpdc80li5f6"; }
308− { name = "cardano-crypto";
309− url = "https://github.com/input-output-hk/cardano-crypto.git";
310− rev = "f5cecb6e424cc84f85b6a3e1f803517bb7b4cfb1";
311− sha256 = "1jyzai4sn9hi3p6r97h54f9a7an7vk38lwrbl4mds9zmdsw5f5ad"; }
312− { name = "unlit";
313− url = "https://github.com/michaelpj/unlit.git";
314− rev = "9ca1112093c5ffd356fc99c7dafa080e686dd748";
315− sha256 = "145sffn8gbdn6xp9q5b75yd3m46ql5bnc02arzmpfs6wgjslfhff"; }
316− { name = "prometheus";
317− url = "https://github.com/bitnomial/prometheus.git";
318− rev = "69e4cefeb7d04d61a54cb0ae9fd57e2de134badb";
319− sha256 = "0h836qp0ic587gfyfkj9a53p8rczja50sfy2y8ymx8wwkmq9zdgc"; }
320− { name = "github";
321− url = "https://github.com/shmish111/github.git";
322− rev = "cc27b9de4d5d0939235fa9a8b418de3ea4807bab";
323− sha256 = "0jx65x4c8s561nbxa0hv7mp8fvndfhs8i8gzxng7ym808n4n538i"; }
324− ];
325− # This is needed due to some deficiencies in stackage snapshots.
326− # maybe we should make this part of some `stack-default-pkg-def-extras`?
327− # We have similar logic in the snapshots.nix file to deal with this in
328− # snapshots.
329− #
330− # TODO: move this somewhere into stackProject
331− pkg-def-extras = [
332− (hackage: {
333− packages = {
334− "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
335− "process" = (((hackage.process)."1.6.5.0").revisions).default;
336− };
337− })
338− (hackage: {
339− packages = {
340− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
341− };
342− })
343− ];
344− modules = [ (mkCacheModule cache) ];
345− };
346 in {
63 in {
347 x86_64-linux = {
64 x86_64-linux = {
348 # cardano-sl
65 # cardano-sl
examples/cardano-sl-args.nixnew file+150
@@ -0,0 +1,150 @@
1+let iohk-archive = name: hash: "https://github.com/input-output-hk/${name}/archive/${hash}.tar.gz";
2+in rec {
3+ src = builtins.fetchTarball (iohk-archive "cardano-sl" "1a792d7cd0f0c93a0f0c28f66372bce3c3808dbd");
4+ pkgs = [
5+ "cardano-sl-crypto-test"
6+ "cardano-sl-crypto"
7+ "cardano-sl-cluster"
8+ "cardano-sl-infra"
9+ "cardano-sl-infra-test"
10+ "cardano-sl-tools"
11+ "cardano-sl-tools-post-mortem"
12+ "cardano-sl-core"
13+ "cardano-sl-core-test"
14+ "cardano-sl-util-test"
15+ "cardano-sl-util"
16+ "cardano-sl-script-runner"
17+ "cardano-sl-auxx"
18+ "cardano-sl-networking"
19+ "cardano-sl-explorer"
20+ "cardano-sl-chain-test"
21+ "cardano-sl-chain"
22+ "cardano-sl-mnemonic"
23+ "cardano-sl-generator"
24+ "cardano-sl-x509"
25+ "cardano-sl-utxo"
26+ "cardano-sl-node-ipc"
27+ "cardano-wallet"
28+ "cardano-sl"
29+ "cardano-sl-db-test"
30+ "cardano-sl-db"
31+ "cardano-sl-faucet"
32+ "cardano-sl-binary-test"
33+ "cardano-sl-binary"
34+ "cardano-sl-node"
35+ "cardano-sl-client"
36+ ];
37+ cache = [
38+ { name = "cardano-crypto";
39+ url = "https://github.com/input-output-hk/cardano-crypto";
40+ rev = "4590efa638397e952a51a8994b5543e4ea3c1ecd";
41+ sha256 = "0hl2n3bba5v2j0lmxhs7hs01z3aznh2bwf9cb434icq2g0bl8ms3"; }
42+ { name = "haskell-ip";
43+ cabal-file = "ip.cabal";
44+ url = "https://github.com/andrewthad/haskell-ip";
45+ rev = "9bb453139aa82cc973125091800422a523e1eb8f";
46+ sha256 = "199mfpbgca7rvwvwk2zsmcpibc0sk0ni7c5zlf4gk3cps8s85gyr"; }
47+ { name = "time-units";
48+ url = "https://github.com/serokell/time-units.git";
49+ rev = "6c3747c1ac794f952de996dd7ba8a2f6d63bf132";
50+ sha256 = "0psdr1if0rgnn24698x3583m0603rwd3sd7yb9whj03hskmkwpgs";
51+ }
52+ { name = "kademlia";
53+ url = "https://github.com/serokell/kademlia.git";
54+ rev = "7120bb4d28e708acd52dfd61d3dca7914fac7d7f";
55+ sha256 = "1k1wp9dwhzzqfivxc28vhxfqplnyh916crr7bhsiv829d6qifhw1";
56+ }
57+ { name = "network-transport";
58+ url = "https://github.com/serokell/network-transport";
59+ rev = "018a50b9042c2115c3ec9c9fd5ca5f28737dd29c";
60+ sha256 = "0lqa26l2ikpq6a4s7qm9b2favx59w82i0wngakhfyax66fpixp8q";
61+ }
62+ { name = "network-transport-tcp";
63+ url = "https://github.com/avieth/network-transport-tcp";
64+ rev = "2634e5e32178bb0456d800d133f8664321daa2ef";
65+ sha256 = "03shp9prflhgqzw7pymw1pq2q7s1wf46pyjm2csx8646snrhf35i";
66+ }
67+ { name = "network-transport-inmemory";
68+ url = "https://github.com/avieth/network-transport-inmemory";
69+ rev = "5d8ff2b07b9df35cf61329a3d975e2c8cf95c12a";
70+ sha256 = "0ak64rks3lk3kk5wyndrrk2swmd84h9diribzix305xwz1jhjj9w";
71+ }
72+ { name = "acid-state";
73+ url = "https://github.com/parsonsmatt/acid-state";
74+ rev = "a1b23e2056f134e53f705a694ab85deeecabec5c";
75+ sha256 = "0mgdk8252g7wbb0afyn21pcn3bwh4vainy3h2d0xsv4hlpgqgnw8";
76+ }
77+ { name = "socket-io";
78+ url = "https://github.com/input-output-hk/engine.io";
79+ rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
80+ sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
81+ subdir = "socket-io";
82+ }
83+ { name = "engine-io";
84+ url = "https://github.com/input-output-hk/engine.io";
85+ rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
86+ sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
87+ subdir = "engine-io";
88+ }
89+ { name = "engine-io-wai";
90+ url = "https://github.com/input-output-hk/engine.io";
91+ rev = "d3c55f51bb81cee7d0d551de930ce65fe7d76756";
92+ sha256 = "139c0yfnj57cpwg4k0am2rp35sh959394nvlb98011rjy68200qc";
93+ subdir = "engine-io-wai";
94+ }
95+ { name = "canonical-json";
96+ url = "https://github.com/well-typed/canonical-json.git";
97+ rev = "ddfe3593b80b5ceb88842bb7a6f2268df75d2c2f";
98+ sha256 = "02fzn1xskis1lc1pkz0j92v6ipd89ww0k2p3dvwpm3yap5dpnm7k";
99+ }
100+ { name = "clock";
101+ url = "https://github.com/corsis/clock.git";
102+ rev = "ef60bd51a3587a173adf565c33bf2886df6e3842";
103+ sha256 = "1r4n9imls483f7wd61fi1jk16z2k7w36gpx798sqidvwbnc831q1";
104+ }
105+ { name = "rocksdb-haskell-ng";
106+ url = "https://github.com/input-output-hk/rocksdb-haskell-ng.git";
107+ rev = "49f501a082d745f3b880677220a29cafaa181452";
108+ sha256 = "02jvri8ik8jgrxwa6qmh3xcwqvm4s27iv3sxpjpny79nlhlxvfzp";
109+ }
110+ { name = "log-warper";
111+ url = "https://github.com/input-output-hk/log-warper";
112+ rev = "5271ab6c33541b8155ca203e714875974ec116be";
113+ sha256 = "1h14004a8iwr8nw31pqq6kfdhfsyzzl8a50hrmj2acjqq6mbdl2m";
114+ }
115+ { name = "universum";
116+ url = "https://github.com/input-output-hk/universum";
117+ rev = "15f7db758ff5a24b874de2247f6f7a4576562da5";
118+ sha256 = "127bs29zpjcc40777dv7figk05gd00b9ja57sp11w440qr5h72hk";
119+ }
120+ { name = "serokell-util";
121+ url = "https://github.com/input-output-hk/serokell-util";
122+ rev = "457f1d149c6e238841f283a1faf7bc8fb021b27d";
123+ sha256 = "0llbryqna9p03db3ka4933vzf4jw1yxdbsf7cqi2pivsy1vp6kp0";
124+ }
125+ { name = "inspector";
126+ url = "https://github.com/primetype/inspector.git";
127+ rev = "c975f4329365f0379c04358138e616fb96fb0b79";
128+ sha256 = "12q1v7a8kcw7qi4lws4j3mvxwfkhni6zmp870kmnkgbgwvrax9gs";
129+ }
130+ ];
131+ # This is needed due to some deficiencies in stackage snapshots.
132+ # maybe we should make this part of some `stack-default-pkg-def-extras`?
133+ # We have similar logic in the snapshots.nix file to deal with this in
134+ # snapshots.
135+ #
136+ # TODO: move this somewhere into stackProject
137+ pkg-def-extras = [
138+ (hackage: {
139+ packages = {
140+ "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
141+ "process" = (((hackage.process)."1.6.5.0").revisions).default;
142+ };
143+ })
144+ (hackage: {
145+ packages = {
146+ "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
147+ };
148+ })
149+ ];
150+}
examples/cardano-sl-mingw32.nix+3−38
@@ -1,38 +1,3 @@
1−with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "x86_64-pc-mingw32"; }; }; };
1+with import ../nixpkgs ((import ../.) // { 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.stackProject {
2+(haskell-nix.stackProject (import ./cardano-sl-args.nix))
9−# src = ../cardano-wallet;
10−# modules = [
11−# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12−# ];}).cardano-wallet.components.all
13−(let stack-pkgs = import ../cardano-sl/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15− { inherit stack-pkgs;
16− pkg-def-extras = [(hackage: {
17− packages = {
18− # "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
19− "process" = (((hackage.process)."1.6.5.0").revisions).default;
20− Win32 = hackage.Win32."2.6.1.0".revisions.default;
21− };
22− })
23− (hackage: {
24− packages = {
25− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
26− };
27− })];
28− modules = [
29− { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
30− { packages.alex.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
31− { packages.happy.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
32− { doHaddock = false; }
33− ];
34− # ++ (args.modules or [])
35− # ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
36− };
37− in pkg-set.config.hsPkgs
38−).cardano-sl.components.all
3+ .cardano-sl.components.all
examples/cardano-sl.nix+3−37
@@ -1,37 +1,3 @@
1−with import ../. { nixpkgs = ../nixpkgs; nixpkgsArgs = { }; };
1+with import ../nixpkgs (import ../.);
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.stackProject {
2+(haskell-nix.stackProject (import ./cardano-sl-args.nix))
9−# src = ../cardano-wallet;
10−# modules = [
11−# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12−# ];}).cardano-wallet.components.all
13−(let stack-pkgs = import ../cardano-sl/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15− { inherit stack-pkgs;
16− pkg-def-extras = [(hackage: {
17− packages = {
18− # "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
19− "process" = (((hackage.process)."1.6.5.0").revisions).default;
20− };
21− })
22− (hackage: {
23− packages = {
24− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
25− };
26− })];
27− modules = [
28− { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
29− { packages.alex.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
30− { packages.happy.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
31− { doHaddock = false; }
32− ];
33− # ++ (args.modules or [])
34− # ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
35− };
36− in pkg-set.config.hsPkgs
37−).cardano-sl.components.all
3+ .cardano-sl.components.all
examples/cardano-wallet-args.nixnew file+59
@@ -0,0 +1,59 @@
1+let iohk-archive = name: hash: "https://github.com/input-output-hk/${name}/archive/${hash}.tar.gz";
2+in rec {
3+ src = builtins.fetchTarball (iohk-archive "cardano-wallet" "d525e85fe19a37d8b5648ac783ef35474be38bcc");
4+ pkgs = [
5+ "bech32"
6+ "text-class"
7+ "cardano-wallet-http-bridge"
8+ "cardano-wallet-launcher"
9+ "cardano-wallet-test-utils"
10+ "cardano-wallet-core"
11+ "cardano-wallet-jormungandr"
12+ "cardano-wallet-cli"
13+ "cardano-crypto"
14+ "cardano-wallet-core-integration"
15+ ];
16+ # wee need these, as they are referenced in the stack.yaml file; however we can't
17+ # fetch them at IFD time as they don't provide the sha256. Hence we use the cache-file
18+ # facility on stack-to-nix and pre-populate the cache file with the relevant hashes.
19+ cache = [
20+ { name = "cardano-crypto";
21+ url = "https://github.com/input-output-hk/cardano-crypto";
22+ rev = "3c5db489c71a4d70ee43f5f9b979fcde3c797f2a";
23+ sha256 = "0lss4x41m0ylhximqjc56ps0y3pag3x58wm480pzfa48lpk4gqpk"; }
24+ { name = "persistent-sqlite";
25+ url = "https://github.com/KtorZ/persistent";
26+ rev = "79f2ece07eafae005a703c8eda1bd2420b5e07b5";
27+ sha256 = "081bhdg52wn7vgxsgl4aimy73ccai05j64r24hwkdnjj4kz96lia";
28+ subdir = "persistent-sqlite"; }
29+ { name = "iohk-monitoring";
30+ url = "https://github.com/input-output-hk/iohk-monitoring-framework";
31+ rev = "bd31cd2f3922010ddb76bb869f29c4e63bb8001b";
32+ subdir = "iohk-monitoring";
33+ sha256 = "1dfk505qbpk6p3gcpxa31wmg98qvx9hlrxlf0khaj7hizf3b8b60"; }
34+ { name = "contra-tracer";
35+ url = "https://github.com/input-output-hk/iohk-monitoring-framework";
36+ rev = "bd31cd2f3922010ddb76bb869f29c4e63bb8001b";
37+ subdir = "contra-tracer";
38+ sha256 = "1dfk505qbpk6p3gcpxa31wmg98qvx9hlrxlf0khaj7hizf3b8b60"; }
39+ ];
40+ # This is needed due to some deficiencies in stackage snapshots.
41+ # maybe we should make this part of some `stack-default-pkg-def-extras`?
42+ # We have similar logic in the snapshots.nix file to deal with this in
43+ # snapshots.
44+ #
45+ # TODO: move this somewhere into stackProject
46+ pkg-def-extras = [
47+ (hackage: {
48+ packages = {
49+ "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
50+ "process" = (((hackage.process)."1.6.5.0").revisions).default;
51+ };
52+ })
53+ (hackage: {
54+ packages = {
55+ "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
56+ };
57+ })
58+ ];
59+}
examples/cardano-wallet-mingw32.nix+3−38
@@ -1,38 +1,3 @@
1−with import ../. { nixpkgs = ../../nixpkgs; nixpkgsArgs = { crossSystem = { config = "x86_64-pc-mingw32"; }; }; };
1+with import ../nixpkgs ((import ../.) // { 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.stackProject {
2+(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
9−# src = ../cardano-wallet;
10−# modules = [
11−# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12−# ];}).cardano-wallet.components.all
13−(let stack-pkgs = import ../../cardano-wallet/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15− { inherit stack-pkgs;
16− pkg-def-extras = [(hackage: {
17− packages = {
18− "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
19− "process" = (((hackage.process)."1.6.5.0").revisions).default;
20− Win32 = hackage.Win32."2.8.3.0".revisions.default;
21− };
22− })
23− (hackage: {
24− packages = {
25− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
26− };
27− })];
28− modules = [
29− { packages.Cabal.patches = [ ./overlays/patches/Cabal/fix-data-dir.patch ]; }
30− { packages.alex.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
31− { packages.happy.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
32− { doHaddock = false; }
33− ];
34− # ++ (args.modules or [])
35− # ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
36− };
37− in pkg-set.config.hsPkgs
38−).cardano-wallet.components.all
3+ .cardano-wallet.components.all
examples/cardano-wallet.nix+3−36
@@ -1,36 +1,3 @@
1−with import ../. { nixpkgs = ../../nixpkgs; nixpkgsArgs = { }; };
1+with import ../nixpkgs (import ../.);
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.stackProject {
2+(haskell-nix.stackProject (import ./cardano-wallet-args.nix))
9−# src = ../cardano-wallet;
10−# modules = [
11−# ({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
12−# ];}).cardano-wallet.components.all
13−(let stack-pkgs = import ../../cardano-wallet/flags-test/pkgs.nix;
14− in let pkg-set = haskell-nix.mkStackPkgSet
15− { inherit stack-pkgs;
16− pkg-def-extras = [(hackage: {
17− packages = {
18− "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
19− "process" = (((hackage.process)."1.6.5.0").revisions).default;
20− };
21− })
22− (hackage: {
23− packages = {
24− "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
25− };
26− })];
27− modules = [
28− { packages.Cabal.patches = [ ../overlays/patches/Cabal/fix-data-dir.patch ]; }
29− { packages.alex.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
30− { packages.happy.package.setup-depends = [pkg-set.config.hsPkgs.Cabal]; }
31− ];
32− # ++ (args.modules or [])
33− # ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
34− };
35− in pkg-set.config.hsPkgs
36−).cardano-wallet.components.all
3+ .cardano-wallet.components.all
examples/plutus-args.nixnew file+53
@@ -0,0 +1,53 @@
1+let iohk-archive = name: hash: "https://github.com/input-output-hk/${name}/archive/${hash}.tar.gz";
2+in rec {
3+ src = builtins.fetchTarball (iohk-archive "plutus" "0d76e98ab267d621ad15002b5f824cad71797754");
4+ cache = [
5+ { name = "row-types";
6+ url = "https://github.com/target/row-types";
7+ rev = "1e8d5e084ffd46f6c7842826a1f62c60820885df";
8+ sha256 = "0ly5m4r8wkm8gdqyrqzsjfmp189yxsd4qp0zi3idrbgfaf45sk9k"; }
9+ { name = "purescript-bridge";
10+ url = "https://github.com/shmish111/purescript-bridge.git";
11+ rev = "0042602f8a195b1fe185138f9ccca02020b8dd62";
12+ sha256 = "1vl88g41f4vvgw9iyn7zd7i52qshpnk02z0y6czg4zy7wk3q12gz"; }
13+ { name = "servant-purescript";
14+ url = "https://github.com/shmish111/servant-purescript.git";
15+ rev = "ece5d1dad16a5731ac22040075615803796c7c21";
16+ sha256 = "1axcbsaym64q67hvjc7b3izd48cgqwi734l7f7m22jpdc80li5f6"; }
17+ { name = "cardano-crypto";
18+ url = "https://github.com/input-output-hk/cardano-crypto.git";
19+ rev = "f5cecb6e424cc84f85b6a3e1f803517bb7b4cfb1";
20+ sha256 = "1jyzai4sn9hi3p6r97h54f9a7an7vk38lwrbl4mds9zmdsw5f5ad"; }
21+ { name = "unlit";
22+ url = "https://github.com/michaelpj/unlit.git";
23+ rev = "9ca1112093c5ffd356fc99c7dafa080e686dd748";
24+ sha256 = "145sffn8gbdn6xp9q5b75yd3m46ql5bnc02arzmpfs6wgjslfhff"; }
25+ { name = "prometheus";
26+ url = "https://github.com/bitnomial/prometheus.git";
27+ rev = "69e4cefeb7d04d61a54cb0ae9fd57e2de134badb";
28+ sha256 = "0h836qp0ic587gfyfkj9a53p8rczja50sfy2y8ymx8wwkmq9zdgc"; }
29+ { name = "github";
30+ url = "https://github.com/shmish111/github.git";
31+ rev = "cc27b9de4d5d0939235fa9a8b418de3ea4807bab";
32+ sha256 = "0jx65x4c8s561nbxa0hv7mp8fvndfhs8i8gzxng7ym808n4n538i"; }
33+ ];
34+ # This is needed due to some deficiencies in stackage snapshots.
35+ # maybe we should make this part of some `stack-default-pkg-def-extras`?
36+ # We have similar logic in the snapshots.nix file to deal with this in
37+ # snapshots.
38+ #
39+ # TODO: move this somewhere into stackProject
40+ pkg-def-extras = [
41+ (hackage: {
42+ packages = {
43+ "transformers" = (((hackage.transformers)."0.5.6.2").revisions).default;
44+ "process" = (((hackage.process)."1.6.5.0").revisions).default;
45+ };
46+ })
47+ (hackage: {
48+ packages = {
49+ "hsc2hs" = (((hackage.hsc2hs)."0.68.4").revisions).default;
50+ };
51+ })
52+ ];
53+}
examples/plutus-mingw32.nixnew file+3
@@ -0,0 +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
examples/plutus.nixnew file+3
@@ -0,0 +1,3 @@
1+with import ../nixpkgs (import ../.);
2+(haskell-nix.stackProject (import ./plutus-args.nix))
3+ .language-plutus-core.components.all
overlays/haskell.nix+27−1
@@ -226,6 +226,31 @@ self: super: {
226 text = self.buildPackages.lib.concatMapStringsSep "\n" f repos;
226 text = self.buildPackages.lib.concatMapStringsSep "\n" f repos;
227 };
227 };
228
228
229+ mkCacheModule = cache:
230+ # for each item in the `cache`, set
231+ # packages.$name.src = fetchgit ...
232+ # and
233+ # packages.$name.postUnpack = ...
234+ # if subdir is given.
235+ #
236+ # We need to do this, as cabal-to-nix will generate
237+ # src = /nix/store/... paths, and when we build the
238+ # package we won't have access to the /nix/store
239+ # path. As such we regenerate the fetchgit command
240+ # we used in the first place, and thus have a proper
241+ # src value.
242+ #
243+ # TODO: this should be moved into `call-stack-to-nix`
244+ # it should be automatic and not the burden of
245+ # the end user to work around nix peculiarities.
246+ { packages = builtins.foldl' (x: y: x // y) {}
247+ (builtins.map ({ name, url, rev, sha256, subdir ? null, ... }:
248+ { ${name} = { src = self.buildPackages.pkgs.fetchgit { inherit url rev sha256; }; }
249+ // self.buildPackages.lib.optionalAttrs (subdir != null)
250+ { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
251+ }) cache);
252+ };
253+
229 # Takes a haskell src directory runs cabal new-configure and plan-to-nix.
254 # Takes a haskell src directory runs cabal new-configure and plan-to-nix.
230 # Resulting nix files are added to nix-plan subdirectory.
255 # Resulting nix files are added to nix-plan subdirectory.
231 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
256 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
@@ -299,7 +324,8 @@ self: super: {
299 { inherit stack-pkgs;
324 { inherit stack-pkgs;
300 pkg-def-extras = (args.pkg-def-extras or []);
325 pkg-def-extras = (args.pkg-def-extras or []);
301 modules = (args.modules or [])
326 modules = (args.modules or [])
302− ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; };
327+ ++ self.lib.optional (args ? ghc) { ghc.package = args.ghc; }
328+ ++ self.lib.optional (args ? cache) (mkCacheModule args.cache);
303 };
329 };
304 in pkg-set.config.hsPkgs;
330 in pkg-set.config.hsPkgs;
305 };
331 };