|
| 1 | +#! /usr/bin/env nix-shell |
| 2 | +#! nix-shell -I "nixpkgs=channel:nixos-21.11" --pure -i bash -p nixUnstable cabal-install ghc git nix-prefetch-git cacert |
| 3 | + |
| 4 | +export NIX_PATH="nixpkgs=channel:nixos-21.11" |
| 5 | +index_state="2020-01-10T00:00:00Z" |
| 6 | +expected_hash="0z2jc4fibfxz88pfgjq3wk5j3v7sn34xkwb8h60hbwfwhhy63vx6" |
| 7 | + |
| 8 | +set -euo pipefail |
| 9 | + |
| 10 | +# This file can interfere with the build. |
| 11 | +# https://github.com/input-output-hk/haskell.nix/issues/57 |
| 12 | +rm -f .nix-tools.cache |
| 13 | + |
| 14 | +echo "+++ Cabal configure" |
| 15 | +cabal new-update |
| 16 | +cabal new-configure |
| 17 | + |
| 18 | +echo |
| 19 | +echo "+++ Run stable version of plan-to-nix" |
| 20 | +nix build --impure --expr '(let haskellNix = import (builtins.fetchTarball "https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz") {}; in (import haskellNix.sources.nixpkgs haskellNix.nixpkgsArgs).haskell-nix.nix-tools.ghc8107)' -o nt |
| 21 | +./nt/bin/plan-to-nix --output .buildkite/nix1 --plan-json dist-newstyle/cache/plan.json |
| 22 | + |
| 23 | +# Replace currently broken plan-to-nix output |
| 24 | +cp .buildkite/fixed.nix .buildkite/nix1/default.nix |
| 25 | + |
| 26 | +echo |
| 27 | +echo "+++ Build project" |
| 28 | +nix build -f .buildkite/nix1 nix-tools.components.exes --no-link |
| 29 | + |
| 30 | +echo |
| 31 | +echo "+++ Run tests" |
| 32 | +echo "There are no tests -- https://github.com/input-output-hk/haskell.nix/issues/51" |
| 33 | + |
| 34 | +echo |
| 35 | +echo "+++ Add runtime dependencies to PATH" |
| 36 | + |
| 37 | +nix build -f channel:nixos-20.03 nix-prefetch-scripts -o nix-prefetch-scripts |
| 38 | +nix build -f channel:nixos-20.03 git -o git |
| 39 | +export PATH="$PWD/nix-prefetch-scripts/bin:$PWD/git/bin:$PATH" |
| 40 | + |
| 41 | +echo |
| 42 | +echo "+++ Run plan-to-nix again" |
| 43 | + |
| 44 | +# This file can interfere with the build. |
| 45 | +# https://github.com/input-output-hk/haskell.nix/issues/57 |
| 46 | +rm -f .nix-tools.cache |
| 47 | + |
| 48 | +nix build -f .buildkite/nix1 nix-tools.components.exes.plan-to-nix |
| 49 | +./result/bin/plan-to-nix --output .buildkite/nix2 --plan-json dist-newstyle/cache/plan.json |
| 50 | + |
| 51 | +# Add module needed to allow Cabal 3.2 to be installed |
| 52 | +sed -i -e 's|modules = \[\]|modules = \[{ nonReinstallablePkgs = \[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base" "deepseq" "array" "ghc-boot-th" "pretty" "template-haskell" "ghcjs-prim" "ghcjs-th" "ghc-boot" "ghc" "Win32" "array" "binary" "bytestring" "containers" "directory" "filepath" "ghc-boot" "ghc-compact" "ghc-prim" "hpc" "mtl" "parsec" "process" "text" "time" "transformers" "unix" "xhtml" "stm" "terminfo" \]; }\]|' \ |
| 53 | + .buildkite/nix2/default.nix |
| 54 | + |
| 55 | +echo |
| 56 | +echo "+++ Build project" |
| 57 | + |
| 58 | +nix build -f .buildkite/nix2 nix-tools.components.exes --no-link |
| 59 | + |
| 60 | +echo |
| 61 | +echo "--- Test index file truncation" |
| 62 | + |
| 63 | +shopt -s nullglob |
| 64 | +for a in /nix/store/*-00-index.tar.gz; do nix-store --delete $a; done |
| 65 | +shopt -u nullglob |
| 66 | + |
| 67 | +nix build -f test/truncate-index.nix --no-link \ |
| 68 | + --arg nix-tools-path ./.buildkite/nix2 \ |
| 69 | + --argstr index-state "$index_state" \ |
| 70 | + --argstr hash "$expected_hash" \ |
| 71 | + indexTruncated |
0 commit comments