haskell.nix/test/regen.nix

69 lines
1.2 KiB
Nix
Raw Normal View History

# A script for regenerating nix for tests
let
haskellNix = (import ../default.nix {});
in
{ pkgs ? import nixpkgs nixpkgsArgs
Remove internal deps on default ghc and stackage (#738) Changes to the interface of haskell.nix (from the changelog.md file): * Removed `sources.nixpkgs-default`, use `sources.nixpkgs` instead. * Removed `./nixpkgs` directory, use `(import ./. {}).sources` or `./nix/sources.nix` instead. * Removes V1 interface for details on how to fix old code see: https://github.com/input-output-hk/haskell.nix/issues/709 * Removed defaultCompilerNixName. * cabalProject, cabalProject', hackage-project and hackage-package now require a `compiler-nix-name` argument. * `haskell-nix.tool` and `.tools` now require a `compiler-nix-name` argument. New functions `p.tool` and `p.tools` (where p is a project) do not. Like `shellFor { tools = ... }` they will use the compiler nix name from the project (including stack projects where it is derived from the resolver). * `haskell-nix.alex` and `haskell-nix.happy` have been removed. Use `p.tool "alex" "3.2.5"` or `shellFor { tools = { alex = "3.2.5"; } }`. * `haskell-nix.nix-tools` -> `haskell-nix.nix-tools.ghc883` (it includes the hpack exe now). * `haskell-nix.cabal-install` -> `p.tool "cabal" "3.2.0.0"` or `shellFor { tools = { cabal = "3.2.0.0"; } }` * `haskell-nix.haskellNixRoots` -> `haskell-nix.roots ghc883` or `p.roots` Other changes: Adds hpack executable to the nix-tools derivations. Adds a `cabal-hpack` test to make sure `hpack` works with `cabalProject`. Reduces the number of calls to `cabalProject` (particularly when checking materialization), by giving internal tools a per-compiler attribute. Uses happy 1.19.12 when building newer ghc versions. Updates cabal-install 3.2.0.0 to use the source from github that is compatible with ghc 8.10.1. Updates the docs for callCabalProjectToNix. Adds a license mapping to fix a common warning.
2020-07-08 13:54:01 +03:00
, nixpkgs ? haskellNix.sources.nixpkgs
, nixpkgsArgs ? haskellNix.nixpkgsArgs
}:
with pkgs;
writeScript "regen-tests.sh" ''
#!${pkgs.runtimeShell}
set -euo pipefail
2019-11-05 02:50:50 +03:00
export PATH="${lib.makeBinPath [ coreutils glibc haskell-nix.nix-tools cabal-install haskell-nix.compiler.ghc865 ]}"
cabal_configure() {
cabal new-configure \
--with-compiler ghc-8.6.5 \
--constraint 'transformers == 0.5.6.2' \
--constraint 'process == 1.6.5.0'
}
plan_nix() {
plan-to-nix -o . --plan-json dist-newstyle/cache/plan.json
}
cabal_nix() {
cabal-to-nix $1.cabal > $1.nix
}
regen() {
cabal_configure
plan_nix
cabal_nix $1
}
cd builder-haddock
regen test-haddock
cd ..
cd cabal-22
regen project
cd ..
cd cabal-simple
regen cabal-simple
cd ..
cd cabal-sublib
regen cabal-sublib
cd ..
cd with-packages
regen test-with-packages
cd ..
cd stack-simple
stack-to-nix -o .
cd ..
cd shell-for
cabal_configure
plan-to-nix -o . --plan-json dist-newstyle/cache/plan.json --cabal-project cabal.project
cd ..
''