on iko/ghcjs-patch-master help sign in
Bump nix-tools to latest master (#955)

* Bump nix-tools to latest master * Add docs for checking nix-tools materialization Co-authored-by: Hamish Mackenzie <Hamish.Mackenzie@iohk.io>

commitd6e47d8b507a07757286de11f135c988120ddcda authorRodney Lorrimar <rodney.lorrimar@iohk.io> dateThu 3 Dec 2020, 19:53 (6 years ago) parent131433c
4 files changed+19−106
docs/dev/nix-tools-pin.md+16 nix-tools/README.md−3 nix-tools/regenerate.nix−100 nix/sources.json+3−3
docs/dev/nix-tools-pin.mdnew file+16
@@ -0,0 +1,16 @@
1+## How to update [`nix-tools`](https://github.com/input-output-hk/nix-tools)
2+
3+1. Use niv to update the sources.json:
4+
5+ ```
6+ niv update nix-tools
7+ ```
8+
9+
10+2. If `nix-tools.cabal` or `plan-to-nix` have changed, check the
11+ materialized files for each of the compiler nix name in
12+ `ls -d materialized/ghc*/nix-tools` with:
13+
14+ ```
15+ nix-build scripts/check-compiler-materialization --argstr compiler-nix-name ghc884
16+ ```
nix-tools/README.mddeleted−3
@@ -1,3 +0,0 @@
1−# Updating nix-tools
2−
3−Please see the `regenerate.nix` script.
nix-tools/regenerate.nixdeleted−100
@@ -1,100 +0,0 @@
1−# Update script to update nix-tools.
2−#
3−# This script might still come in handy, but it should now be possible to update
4−# the nix-tools materialization without it.
5−#
6−# Without this script:
7−# 1. run `nix-prefetch-git https://github.com/input-output-hk/nix-tools > nix-tools-src-new.json`
8−# 2. run `nix-build -E '(import ./. { checkMaterialization = true; }).pkgs.haskell-nix.nix-tools'`
9−# 3. If it fails apply the fixes from the log (there should be rm, cp and chmod commands)
10−#
11−# To bootstrap materialization files for a new compiler (e.g. for ghc 8.8.3)
12−#
13−# nix-build -E 'let h = (import ./. {}).pkgs.haskell-nix; in h.cabal-install-tool { compiler-nix-name = "ghc884"; checkMaterialization = true; inherit (h) cabal-install nix-tools; }'
14−# nix-build -E 'let h = (import ./. {}).pkgs.haskell-nix; in h.nix-tools-set { compiler-nix-name = "ghc884"; checkMaterialization = true; inherit (h) cabal-install nix-tools; }'
15−# nix-build -E 'let h = (import ./. {}).pkgs.haskell-nix; in h.alex-tool { compiler-nix-name = "ghc884"; checkMaterialization = true; inherit (h) cabal-install nix-tools; }'
16−# nix-build -E 'let h = (import ./. {}).pkgs.haskell-nix; in h.happy-tool { compiler-nix-name = "ghc884"; checkMaterialization = true; inherit (h) cabal-install nix-tools; }'
17−#
18−# Using the script:
19−# 1. run `nix-prefetch-git https://github.com/input-output-hk/nix-tools > nix-tools-src-new.json`
20−# 2. run `nix-build regenerate.nix --show-trace --arg specJSON ./nix-tools-src-new.json`
21−# 3. run `./result/bin/update-nix-tools` and follow the instructions.
22−# 4. git commit -a -m "bump nix-tools"
23−#
24−let
25− inherit (import ../default.nix {}) sources nixpkgsArgs;
26−in
27−{ specJSON ? ./nix-tools-src.json }:
28−with import sources.nixpkgs nixpkgsArgs;
29−let
30− src = haskell-nix.cleanSourceHaskell {
31− src = haskell-nix.fetchExternal {
32− name = "nix-tools-src";
33− inherit specJSON;
34− override = "nix-tools-src";
35− };
36− };
37−in
38− let plan-to-nix = (haskell-nix.cabalProject {
39− compiler-nix-name = "ghc865";
40− name = "nix-tools";
41− inherit src;
42− modules = [{
43− # Remove Cabal from nonReinstallablePkgs to be able to pick Cabal-3.2.
44− nonReinstallablePkgs= [ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
45− "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
46− # ghcjs custom packages
47− "ghcjs-prim" "ghcjs-th"
48− "ghc-boot"
49− "ghc" "Win32" "array" "binary" "bytestring" "containers"
50− "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim"
51− # "ghci" "haskeline"
52− "hpc"
53− "mtl" "parsec" "process" "text" "time" "transformers"
54− "unix" "xhtml"
55− # "stm" "terminfo"
56− ];
57− }];
58− }).nix-tools.components.exes.plan-to-nix;
59− bootstrap = if pkgs.targetPlatform.isAarch64 && pkgs.buildPlatform.isAarch64
60− then haskell-nix.bootstrap.compiler.ghc882
61− else haskell-nix.bootstrap.compiler.ghc844;
62− in
63−with builtins;
64−with stdenv.lib;
65−writeShellScriptBin "update-nix-tools" ''
66− export PATH="${getBin nix}/bin:${getBin nix-prefetch-scripts}/bin:${getBin git}/bin:${getBin haskell-nix.cabal-install}/bin:${getBin plan-to-nix}/bin:${getBin coreutils}/bin:${getBin findutils}/bin"
67−
68− TMP=$(mktemp -d)
69− echo $TMP
70−
71− cd $TMP
72− cp ${src}/nix-tools.cabal .
73− cp ${src}/cabal.project .
74− cp ${specJSON} ./nix-tools-src.json
75−
76− echo "--> Updating cabal index..."
77− cabal v2-update -v0
78−
79− # build for the current ghc in haskell.nix
80− echo "--> Configuring nix-tools for ${haskell-nix.ghc.name}..."
81− cabal v2-configure -w ${getBin haskell-nix.ghc}/bin/ghc -v0
82− echo "--> Running plan-to-nix for ${haskell-nix.ghc.name}..."
83− plan-to-nix -o . --plan-json=$(find . -name "plan.json")
84−
85− rm cabal.project.local
86− rm -fR dist-newstyle
87−
88− # we don't want the default.nix that plan-to-nix generates to
89− # update the custom one in nix-tools
90− mv pkgs.nix default.nix
91−
92− rm -f nix-tools.cabal
93− echo "--> Done."
94− echo "******"
95− echo "*** please copy $TMP/ into haskell.nix/materialized/GHCVER/nix-tools"
96− echo "***"
97− echo "*** cp -fr "$TMP/" ../materialized/GHCVER/nix-tools/"
98− echo "***"
99− echo "******"
100−''
nix/sources.json+3−3
@@ -46,10 +46,10 @@
4646 "homepage": null,
4747 "owner": "input-output-hk",
4848 "repo": "nix-tools",
49− "rev": "595ca11bfe79fd929c1a18e07a4fdc0e3363eb82",
50− "sha256": "1s7kwpc4x7gx4ix29n3kdf81516jpv2bs7kkv557q1zjlz7ll8kf",
49+ "rev": "9a47eb9a4166bc3e626b4e6607e5542be2d86a96",
50+ "sha256": "08r1k6ankzh9k2q8p005q3sdw94ih7yifj8pywrpnjssmj0wxznx",
5151 "type": "tarball",
52− "url": "https://github.com/input-output-hk/nix-tools/archive/595ca11bfe79fd929c1a18e07a4fdc0e3363eb82.tar.gz",
52+ "url": "https://github.com/input-output-hk/nix-tools/archive/9a47eb9a4166bc3e626b4e6607e5542be2d86a96.tar.gz",
5353 "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
5454 },
5555 "nixpkgs": {