on iko/ghcjs-patch-master help sign in
Add `evalSystem` and `evalPackages` project args (#1546)

This adds a way to specify the `evalSystem` or `evalPackages` explicitly when calling the `project` functions. Currently if we want to make a `flake` that supports multiple systems we have few options: * Require builders for all the supported systems (even just for `nix flake show`). * Pass `--impure` so that haskell.nix can see `builtins.currentSystem` to set up `pkgs.evalPackages` to use that. Unfortunately this prevents nix from caching some of the work it does and often results in it recalculating for each supported system when it would otherwise be cached and take no time at all. * Add an overlay to replace `evalPackages`. This works, but it is not straight forward. * Materialize the nix files for the project. This change allows `evalSystem = "x86_64-linux";` to be passed telling `haskell.nix` to run `cabal` and `nix-tools` on that system. The user will have to have a builder for that system, but does not need to have builders for the others (unless building outputs for them).

commita443611ecfc5bfb4d1b948456169e7671c53d3b5 authorHamish Mackenzie <Hamish.K.Mackenzie@gmail.com> dateThu 28 Jul 2022, 20:03 (4 years ago) parent7f02c05
82 files changed+536−428
.buildkite/pipeline.yml+6 build.nix+7−5 builder/default.nix+3−2 builder/shell-for.nix+8−3 changelog.md+26 ci.nix+7−8 flake.nix+7−1 hix/project.nix+5−5 lib/cabal-project-parser.nix+11−11 lib/call-cabal-project-to-nix.nix+20−17 lib/call-stack-to-nix.nix+13−11 lib/default.nix+13−14 lib/ghcjs-project.nix−1 lib/spdx/licenses.nix+3−3 lib/stack-cache-generator.nix+17−14 lib/system-nixpkgs-map.nix+1−1 lib/system-pkgs.nix−5 mk-local-hackage-repo/default.nix+1−1 modules/cabal-project.nix−5 modules/component-driver.nix+1−1 modules/hackage-project.nix+60 overlays/hackage-quirks.nix → modules/hackage-quirks.nix+22−17 modules/plan.nix+7 modules/project-common.nix+35−1 modules/stack-project.nix+2−7 overlays/bootstrap.nix+19−11 overlays/default.nix−4 overlays/eval-packages.nix−14 overlays/ghc-packages.nix+8−7 overlays/haskell.nix+32−74 overlays/hix.nix+3−3 overlays/nix-prefetch-git-minimal.nix+14 overlays/tools.nix+25−43 test/buildable/default.nix+2−2 test/builder-haddock/default.nix+3−1 test/c-ffi/default.nix+2−2 test/ca-derivations-include/default.nix+3−3 test/ca-derivations/default.nix+3−3 test/cabal-22/default.nix+2−2 test/cabal-doctests/default.nix+2−2 test/cabal-hpack/default.nix+2−2 test/cabal-simple-debug/default.nix+2−2 test/cabal-simple-prof/default.nix+2−2 test/cabal-simple/default.nix+2−2 test/cabal-source-repo-comments/default.nix+2−2 test/cabal-source-repo/default.nix+2−2 test/cabal-sublib/default.nix+2−2 test/call-cabal-project-to-nix/default.nix+3−2 test/call-stack-to-nix/default.nix+3−2 test/coverage-golden/default.nix+2−2 test/coverage-no-libs/default.nix+2−1 test/coverage/default.nix+2−1 test/default.nix+52−51 test/exe-dlls/default.nix+2−2 test/exe-lib-dlls/default.nix+2−2 test/exe-only/default.nix+2−2 test/external-static-plugin/default.nix+2−2 test/extra-hackage/default.nix+2−2 test/fully-static/default.nix+5 test/ghc-options/cabal.nix+2−2 test/ghc-options/stack.nix+2−1 test/ghcjs-overlay/default.nix+2−2 test/githash/default.nix+2−2 test/haskell-language-server/cabal.nix+2−2 test/haskell-language-server/stack.nix+3−3 test/index-state/default.nix+2−2 test/project-flags/cabal.nix+2−2 test/project-flags/stack.nix+2−1 test/setup-deps/default.nix+3−3 test/sha256map/default.nix+2−2 test/shell-for-setup-deps/default.nix+2−2 test/shell-for/default.nix+2−1 test/snapshots/default.nix+1−1 test/stack-local-resolver-subdir/default.nix+2−1 test/stack-local-resolver/default.nix+2−1 test/stack-remote-resolver/default.nix+2−1 test/stack-simple/default.nix+2−2 test/stack-source-repo/default.nix+2−1 test/sublib-docs/default.nix+2−2 test/th-dlls/default.nix+2−2 test/unit.nix+4−4 test/with-packages/default.nix+3−1
.buildkite/pipeline.yml+6
@@ -44,3 +44,9 @@ steps:
4444 - nix build .#roots.x86_64-linux --option allow-import-from-derivation false
4545 agents:
4646 system: x86_64-linux
47+
48+ - label: 'Check that evaluation of hydra jobs works without using remote builders'
49+ command:
50+ - nix-instantiate release.nix -A required-unstable-ghc8107-x86_64-darwin-native --show-trace --builders ''
51+ agents:
52+ system: x86_64-linux
build.nix+7−5
@@ -8,8 +8,9 @@ in
88{ nixpkgs ? haskellNix.sources.nixpkgs-2111
99, nixpkgsArgs ? haskellNix.nixpkgsArgs
1010, pkgs ? import nixpkgs nixpkgsArgs
11+, evalPackages ? import nixpkgs nixpkgsArgs
1112, nixpkgsForHydra ? haskellNix.sources.nixpkgs-2105
12−, pkgsForHydra ? import nixpkgsForHydra nixpkgsArgs
13+, pkgsForHydra ? import nixpkgsForHydra (nixpkgsArgs // { inherit (pkgs) system; })
1314, ifdLevel ? 1000
1415, compiler-nix-name ? throw "No `compiler-nix-name` passed to build.nix"
1516}:
@@ -19,12 +20,13 @@ let
1920 buildHaskell = pkgs.buildPackages.haskell-nix;
2021 tool = buildHaskell.tool;
2122in rec {
22− tests = import ./test/default.nix { inherit pkgs ifdLevel compiler-nix-name; };
23+ tests = import ./test/default.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
2324
2425 tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
2526 pkgs.recurseIntoAttrs ({
26− cabal-latest = tool compiler-nix-name "cabal" "latest";
27+ cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; };
2728 hlint-latest = tool compiler-nix-name "hlint" {
29+ inherit evalPackages;
2830 version = {
2931 "ghc865" = "3.2.8";
3032 "ghc882" = "3.3.6";
@@ -33,7 +35,7 @@ in rec {
3335 }.compiler-nix-name or "latest";
3436 };
3537 } // pkgs.lib.optionalAttrs (!__elem compiler-nix-name ["ghc921" "ghc922" "ghc923"]) {
36− hls-latest = tool compiler-nix-name "haskell-language-server" "latest";
38+ hls-latest = tool compiler-nix-name "haskell-language-server" { inherit evalPackages; };
3739 })
3840 );
3941
@@ -85,7 +87,7 @@ in rec {
8587 # These are pure parts of maintainer-script so they can be built by hydra
8688 # and added to the cache to speed up buildkite.
8789 maintainer-script-cache = pkgs.recurseIntoAttrs (
88− (pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
90+ (pkgs.lib.optionalAttrs (pkgsForHydra.system == "x86_64-linux") {
8991 inherit (maintainer-scripts) check-hydra;
9092 })
9193 // (pkgs.lib.optionalAttrs (ifdLevel > 2) {
builder/default.nix+3−2
@@ -1,4 +1,4 @@
1−{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, pkgconfig, nonReinstallablePkgs, hsPkgs, compiler }:
1+{ pkgs, buildPackages, evalPackages, stdenv, lib, haskellLib, ghc, compiler-nix-name, fetchurl, pkgconfig, nonReinstallablePkgs, hsPkgs, compiler }:
22
33let
44 # Builds a single component of a package.
@@ -46,6 +46,7 @@ let
4646 hoogleLocal = let
4747 nixpkgsHoogle = import (pkgs.path + /pkgs/development/haskell-modules/hoogle.nix);
4848 in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc8107" "hoogle" {
49+ inherit evalPackages;
4950 version = "5.0.18.3";
5051 index-state = pkgs.haskell-nix.internalHackageIndexState;
5152 }
@@ -66,7 +67,7 @@ let
6667
6768 # Same as haskellPackages.shellFor in nixpkgs.
6869 shellFor = haskellLib.weakCallPackage pkgs ./shell-for.nix {
69− inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib buildPackages compiler;
70+ inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib buildPackages evalPackages compiler;
7071 inherit (buildPackages) glibcLocales;
7172 };
7273
builder/shell-for.nix+8−3
@@ -1,4 +1,4 @@
1−{ lib, stdenv, mkShell, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, compiler }:
1+{ lib, stdenv, mkShell, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, evalPackages, compiler }:
22
33{ # `packages` function selects packages that will be worked on in the shell itself.
44 # These packages will not be built by `shellFor`, but their
@@ -133,7 +133,12 @@ let
133133 # inherit (hsPkgs) hoogle;
134134 } // (
135135 lib.optionalAttrs (args ? tools && args.tools ? hoogle) {
136− hoogle = buildPackages.haskell-nix.tool compiler.nix-name "hoogle" args.tools.hoogle;
136+ hoogle = buildPackages.haskell-nix.hackage-tool (
137+ haskellLib.versionOrModToMods args.tools.hoogle ++ [{
138+ name = "hoogle";
139+ compiler-nix-name = compiler.nix-name;
140+ inherit evalPackages;
141+ }]);
137142 }
138143 ));
139144
@@ -147,7 +152,7 @@ in
147152 nativeBuildInputs = [ ghcEnv ]
148153 ++ nativeBuildInputs
149154 ++ mkDrvArgs.nativeBuildInputs or []
150− ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools)
155+ ++ lib.attrValues (buildPackages.haskell-nix.tools evalPackages compiler.nix-name tools)
151156 # If this shell is a cross compilation shell include
152157 # wrapper script for running cabal build with appropriate args.
153158 # Includes `--with-compiler` in case the `cabal.project` file has `with-compiler:` in it.
changelog.md+26
@@ -1,6 +1,32 @@
11This file contains a summary of changes to Haskell.nix and `nix-tools`
22that will impact users.
33
4+## Jul 27, 2022
5+* Removed reliance on `builtins.currentSystem`. It was used it to provide
6+ `pkgs.evalPackages` via an overlay that it used to run derivations
7+ used in imports from derivation (IFDs).
8+
9+ These derivations are now run on `buildPackages` by default.
10+
11+ Passsing `evalPackages` to a project function will change where all the
12+ derivations used in IFDs are run for that project (including shell tools):
13+ evalPackages = import nixpkgs haskellNix.nixpkgsArgs;
14+
15+ Passing `evalSystem` instead will use create a suitable `nixpkgs` using `pkgs.path`
16+ and `pkgs.overlay`:
17+ evalSystem = "x86_64-linux";
18+ or
19+ evalSystem = builtins.currentSystem;
20+
21+ The `haskellLib.cleanGit` function is also affected by this change. If you are cross
22+ compiling and using `cleanGit` you should probably do something like:
23+ pkgs = import nixpkgs haskellNix.nixpkgsArgs;
24+ evalPackages = import nixpkgs (haskellNix.nixpkgsArgs // { system = evalSystem; });
25+ p = pkgs.pkgsCross.mingwW64.haskell-nix.cabalProject {
26+ inherit evalPackages;
27+ src = evalPackages.haskell-nix.haskellLib.cleanGit { src = ./.; };
28+ };
29+
430## Feb 16, 2022
531* Removed lookupSha256 argument from project functions.
632 Pass a `sha256map` instead.
ci.nix+7−8
@@ -78,12 +78,11 @@
7878in
7979dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
8080 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
81− # We need this for generic nixpkgs stuff at the right version
82− genericPkgs = import pinnedNixpkgsSrc {};
83− in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: {runTests}:
84− dimension "System" (systems nixpkgsName genericPkgs compiler-nix-name) (systemName: system:
81+ evalPackages = import pinnedNixpkgsSrc nixpkgsArgs;
82+ in dimension "GHC version" (compilerNixNames nixpkgsName evalPackages) (compiler-nix-name: {runTests}:
83+ dimension "System" (systems nixpkgsName evalPackages compiler-nix-name) (systemName: system:
8584 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
86− build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
85+ build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
8786 platformFilter = platformFilterGeneric pkgs system;
8887 in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
8988 # Native builds
@@ -96,14 +95,14 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
9695 } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
9796 iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
9897 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
99− hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).getComponent "exe:hello";
98+ hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello";
10099 });
101100 }
102101 //
103− dimension "Cross system" (crossSystems nixpkgsName genericPkgs compiler-nix-name system) (crossSystemName: crossSystem:
102+ dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name system) (crossSystemName: crossSystem:
104103 # Cross builds
105104 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
106− build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
105+ build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
107106 in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
108107 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
109108 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
flake.nix+7−1
@@ -59,7 +59,7 @@
5959 };
6060 };
6161
62− outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, flake-utils, ... }@inputs:
62+ outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-2105, nixpkgs-2111, nixpkgs-2205, flake-utils, ... }@inputs:
6363 let compiler = "ghc923";
6464 config = import ./config.nix;
6565 in {
@@ -101,6 +101,12 @@
101101 };
102102 pkgs = import nixpkgs
103103 (nixpkgsArgs // { localSystem = { inherit system; }; });
104+ pkgs-2105 = import nixpkgs-2105
105+ (nixpkgsArgs // { localSystem = { inherit system; }; });
106+ pkgs-2111 = import nixpkgs-2111
107+ (nixpkgsArgs // { localSystem = { inherit system; }; });
108+ pkgs-2205 = import nixpkgs-2205
109+ (nixpkgsArgs // { localSystem = { inherit system; }; });
104110 pkgs-unstable = import nixpkgs-unstable
105111 (nixpkgsArgs // { localSystem = { inherit system; }; });
106112 hix = import ./hix/default.nix { inherit pkgs; };
hix/project.nix+5−5
@@ -56,20 +56,20 @@ let
5656 nixpkgsArgs = config.haskellNix.nixpkgsArgs // {
5757 overlays = config.haskellNix.nixpkgsArgs.overlays ++ config.overlays;
5858 };
59− pkgs = import config.nixpkgs config.nixpkgsArgs;
60− project = config.pkgs.haskell-nix.project [
59+ _module.args.pkgs = import config.nixpkgs config.nixpkgsArgs;
60+ project = pkgs.haskell-nix.project [
6161 (import ../modules/hix-project.nix)
6262 userDefaults
6363 projectDefaults
6464 commandArgs'
65− {
65+ ({config, ...}: {
6666 src =
6767 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
68− then config.pkgs.haskell-nix.haskellLib.cleanGit {
68+ then config.evalPackages.haskell-nix.haskellLib.cleanGit {
6969 inherit src name;
7070 }
7171 else src;
72− }
72+ })
7373 ];
7474 })
7575 ];
lib/cabal-project-parser.nix+11−11
@@ -122,7 +122,7 @@ let
122122 # This works because `cabal configure` does not include any of the `/nix/sore/`
123123 # paths in the `plan.json` (so materialized plan-nix will still work as expeced).
124124 # See tests/unit.nix for examples of input and output.
125− parseRepositoryBlock = cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: block:
125+ parseRepositoryBlock = evalPackages: cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: block:
126126 let
127127 lines = pkgs.lib.splitString "\n" block;
128128 # The first line will contain the repository name.
@@ -138,7 +138,7 @@ let
138138 # The $HOME/.cabal/packages/${name} after running `cabal v2-update` to download the repository
139139 repoContents = if inputMap ? ${attrs.url}
140140 # If there is an input use it to make `file:` url and create a suitable `.cabal/packages/${name}` directory
141− then pkgs.evalPackages.runCommand name ({
141+ then evalPackages.runCommand name ({
142142 nativeBuildInputs = [ cabal-install ];
143143 preferLocalBuild = true;
144144 }) ''
@@ -155,9 +155,9 @@ let
155155 cabal v2-update ${name}
156156 cp -r $HOME/.cabal/packages/${name} $out
157157 ''
158− else pkgs.evalPackages.runCommand name ({
159− nativeBuildInputs = [ cabal-install pkgs.evalPackages.curl nix-tools ];
160− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.evalPackages.stdenv.buildPlatform.libc == "glibc") "${pkgs.evalPackages.glibcLocales}/lib/locale/locale-archive";
158+ else evalPackages.runCommand name ({
159+ nativeBuildInputs = [ cabal-install evalPackages.curl nix-tools ];
160+ LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
161161 LANG = "en_US.UTF-8";
162162 preferLocalBuild = true;
163163 } // pkgs.lib.optionalAttrs (sha256 != null) {
@@ -175,15 +175,15 @@ let
175175 ${pkgs.lib.optionalString (attrs ? key-threshold) "key-threshold: ${attrs.key-threshold}"}
176176 EOF
177177
178− export SSL_CERT_FILE=${pkgs.evalPackages.cacert}/etc/ssl/certs/ca-bundle.crt
178+ export SSL_CERT_FILE=${evalPackages.cacert}/etc/ssl/certs/ca-bundle.crt
179179 cabal v2-update ${name}
180180 cp -r $HOME/.cabal/packages/${name} $out
181181 '';
182182 # Output of hackage-to-nix
183183 hackage = import (
184− pkgs.evalPackages.runCommand ("hackage-to-nix-" + name) {
185− nativeBuildInputs = [ cabal-install pkgs.evalPackages.curl nix-tools ];
186− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.evalPackages.stdenv.buildPlatform.libc == "glibc") "${pkgs.evalPackages.glibcLocales}/lib/locale/locale-archive";
184+ evalPackages.runCommand ("hackage-to-nix-" + name) {
185+ nativeBuildInputs = [ cabal-install evalPackages.curl nix-tools ];
186+ LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
187187 LANG = "en_US.UTF-8";
188188 preferLocalBuild = true;
189189 } ''
@@ -196,11 +196,11 @@ let
196196 };
197197 };
198198
199− parseRepositories = cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: projectFile:
199+ parseRepositories = evalPackages: cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: projectFile:
200200 let
201201 # This will leave the name of repository in the first line of each block
202202 blocks = pkgs.lib.splitString "\nrepository " ("\n" + projectFile);
203− repoBlocks = builtins.map (parseRepositoryBlock cabalProjectFileName sha256map inputMap cabal-install nix-tools) (pkgs.lib.lists.drop 1 blocks);
203+ repoBlocks = builtins.map (parseRepositoryBlock evalPackages cabalProjectFileName sha256map inputMap cabal-install nix-tools) (pkgs.lib.lists.drop 1 blocks);
204204 in {
205205 extra-hackages = pkgs.lib.lists.map (block: block.hackage) repoBlocks;
206206 repos = pkgs.lib.lists.foldl' (x: block: x // block.repo) {} repoBlocks;
lib/call-cabal-project-to-nix.nix+20−17
@@ -1,4 +1,4 @@
1−{ dotCabal, pkgs, runCommand, evalPackages, symlinkJoin, cacert, index-state-hashes, haskellLib, materialize }@defaults:
1+{ pkgs, runCommand, cacert, index-state-hashes, haskellLib }@defaults:
22let readIfExists = src: fileName:
33 let origSrcDir = src.origSrcSubDir or src;
44 in
@@ -64,10 +64,13 @@ in
6464 # would result in the "foo" subdirectory of
6565 # any plutus-apps input being used for a
6666 # package.
67+, evalPackages
6768, ...
6869}@args:
6970
7071let
72+ inherit (evalPackages.haskell-nix) materialize dotCabal;
73+
7174 # These defaults are hear rather than in modules/cabal-project.nix to make them
7275 # lazy enough to avoid infinite recursion issues.
7376 # Using null as the default also improves performance as they are not forced by the
@@ -219,8 +222,8 @@ let
219222 in {
220223 # Download the source-repository-package commit and add it to a minimal git
221224 # repository that `cabal` will be able to access from a non fixed output derivation.
222− location = pkgs.evalPackages.runCommand "source-repository-package" {
223− nativeBuildInputs = [ pkgs.evalPackages.rsync pkgs.evalPackages.gitMinimal ];
225+ location = evalPackages.runCommand "source-repository-package" {
226+ nativeBuildInputs = [ evalPackages.rsync evalPackages.gitMinimal ];
224227 } ''
225228 mkdir $out
226229 rsync -a --prune-empty-dirs "${fetched}/" "$out/"
@@ -241,24 +244,24 @@ let
241244
242245 # Parse the `repository` blocks
243246 repoResult = pkgs.haskell-nix.haskellLib.parseRepositories
244− cabalProjectFileName sha256map inputMap cabal-install nix-tools sourceRepoPackageResult.otherText;
247+ evalPackages cabalProjectFileName sha256map inputMap cabal-install nix-tools sourceRepoPackageResult.otherText;
245248
246249 # we need the repository content twice:
247250 # * at eval time (below to build the fixed project file)
248− # Here we want to use pkgs.evalPackages.fetchgit, so one can calculate
251+ # Here we want to use evalPackages.fetchgit, so one can calculate
249252 # the build plan for any target without a remote builder
250253 # * at built time (passed out)
251254 # Here we want to use plain pkgs.fetchgit, which is what a builder
252255 # on the target system would use, so that the derivation is unaffected
253256 # and, say, a linux release build job can identify the derivation
254257 # as built by a darwin builder, and fetch it from a cache
255− sourceReposEval = builtins.map (fetchPackageRepo pkgs.evalPackages.fetchgit) sourceRepoPackageResult.sourceRepos;
258+ sourceReposEval = builtins.map (fetchPackageRepo evalPackages.fetchgit) sourceRepoPackageResult.sourceRepos;
256259 sourceReposBuild = builtins.map (x: (fetchPackageRepo pkgs.fetchgit x).fetched) sourceRepoPackageResult.sourceRepos;
257260 in {
258261 sourceRepos = sourceReposBuild;
259262 inherit (repoResult) repos extra-hackages;
260263 makeFixedProjectFile = ''
261− cp -f ${pkgs.evalPackages.writeText "cabal.project" sourceRepoPackageResult.otherText} ./cabal.project
264+ cp -f ${evalPackages.writeText "cabal.project" sourceRepoPackageResult.otherText} ./cabal.project
262265 '' +
263266 pkgs.lib.optionalString (builtins.length sourceReposEval != 0) (''
264267 chmod +w -R ./cabal.project
@@ -365,12 +368,12 @@ let
365368 '');
366369
367370 # Dummy `ghc` that uses the captured output
368− dummy-ghc = pkgs.evalPackages.writeTextFile {
371+ dummy-ghc = evalPackages.writeTextFile {
369372 name = "dummy-" + ghc.name;
370373 executable = true;
371374 destination = "/bin/${ghc.targetPrefix}ghc";
372375 text = ''
373− #!${pkgs.evalPackages.runtimeShell}
376+ #!${evalPackages.runtimeShell}
374377 case "$*" in
375378 --version*)
376379 cat ${dummy-ghc-data}/ghc/version
@@ -408,12 +411,12 @@ let
408411 };
409412
410413 # Dummy `ghc-pkg` that uses the captured output
411− dummy-ghc-pkg = pkgs.evalPackages.writeTextFile {
414+ dummy-ghc-pkg = evalPackages.writeTextFile {
412415 name = "dummy-pkg-" + ghc.name;
413416 executable = true;
414417 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
415418 text = ''
416− #!${pkgs.evalPackages.runtimeShell}
419+ #!${evalPackages.runtimeShell}
417420 case "$*" in
418421 --version)
419422 cat ${dummy-ghc-data}/ghc-pkg/version
@@ -449,10 +452,10 @@ let
449452 else null;
450453 } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
451454 inherit checkMaterialization;
452− }) (pkgs.evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
453− nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install pkgs.evalPackages.rsync pkgs.evalPackages.gitMinimal ];
455+ }) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
456+ nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
454457 # Needed or stack-to-nix will die on unicode inputs
455− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.evalPackages.stdenv.buildPlatform.libc == "glibc") "${pkgs.evalPackages.glibcLocales}/lib/locale/locale-archive";
458+ LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
456459 LANG = "en_US.UTF-8";
457460 meta.platforms = pkgs.lib.platforms.all;
458461 preferLocalBuild = false;
@@ -474,11 +477,11 @@ let
474477 '';
475478 in {
476479 # These check for cabal configure failure
477− json = pkgs.evalPackages.runCommand (nameAndSuffix "plan-json") {} ''
480+ json = evalPackages.runCommand (nameAndSuffix "plan-json") {} ''
478481 ${checkCabalConfigure}
479482 cp ${plan-nix.maybeJson} $out
480483 '';
481− freeze = pkgs.evalPackages.runCommand (nameAndSuffix "plan-freeze") {} ''
484+ freeze = evalPackages.runCommand (nameAndSuffix "plan-freeze") {} ''
482485 ${checkCabalConfigure}
483486 cp ${plan-nix.maybeFreeze} $out
484487 '';
@@ -520,7 +523,7 @@ let
520523 ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
521524 ${fixedProject.makeFixedProjectFile}
522525 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
523− cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
526+ cp ${evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
524527 cabal.project.freeze
525528 chmod +w cabal.project.freeze
526529 ''}
lib/call-stack-to-nix.nix+13−11
@@ -5,7 +5,6 @@
55 *
66 * see also `call-cabal-project-to-nix`!
77 */
8−{ runCommand, pkgs, mkCacheFile, materialize, haskellLib }:
98{ name ? src.name or null # optional name for better error messages
109, src
1110, stackYaml ? "stack.yaml"
@@ -15,21 +14,24 @@
1514, resolverSha256 ? null
1615, materialized ? null # Location of a materialized copy of the nix files
1716, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
18−, nix-tools ? pkgs.haskell-nix.internal-nix-tools # When building stack projects we use the internal nix-tools (compiled with a fixed GHC version)
19−, ... }:
17+, nix-tools
18+, evalPackages
19+, ... }@args:
2020let
21+ inherit (evalPackages) runCommand;
22+ inherit (evalPackages.haskell-nix) mkCacheFile materialize haskellLib;
2123 inherit (haskellLib.fetchResolver {
2224 inherit src stackYaml resolverSha256;
2325 }) resolver fetchedResolver;
2426
2527 subDir' = src.origSubDir or "";
26− subDir = pkgs.lib.strings.removePrefix "/" subDir';
28+ subDir = evalPackages.lib.strings.removePrefix "/" subDir';
2729 cleanedSource = (haskellLib.cleanSourceWith {
2830 name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files";
2931 src = src.origSrc or src;
3032 filter = path: type: (!(src ? filter) || src.filter path type) && (
3133 type == "directory" ||
32− pkgs.lib.any (i: (pkgs.lib.hasSuffix i path)) [ stackYaml ".cabal" "package.yaml" ]); });
34+ evalPackages.lib.any (i: (evalPackages.lib.hasSuffix i path)) [ stackYaml ".cabal" "package.yaml" ]); });
3335
3436 stackToNixArgs = builtins.concatStringsSep " " [
3537 "--full"
@@ -43,12 +45,12 @@ let
4345 sha256Arg = "stack-sha256";
4446 reasonNotSafe = null;
4547 this = "project.stack-nix" + (if name != null then " for ${name}" else "");
46− } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
48+ } // evalPackages.lib.optionalAttrs (checkMaterialization != null) {
4749 inherit checkMaterialization;
4850 }) (runCommand (if name == null then "stack-to-nix-pkgs" else name + "-stack-to-nix-pkgs") {
49− nativeBuildInputs = [ nix-tools pkgs.nix-prefetch-git pkgs.cacert pkgs.xorg.lndir ];
51+ nativeBuildInputs = [ nix-tools evalPackages.nix-prefetch-git evalPackages.cacert evalPackages.xorg.lndir ];
5052 # Needed or stack-to-nix will die on unicode inputs
51− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive";
53+ LOCALE_ARCHIVE = evalPackages.lib.optionalString (evalPackages.stdenv.hostPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
5254 LANG = "en_US.UTF-8";
5355 LC_ALL = "en_US.UTF-8";
5456 preferLocalBuild = false;
@@ -64,10 +66,10 @@ let
6466 echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
6567 fi
6668 lndir -silent "${cleanedSource}/." $SRC
67− ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
69+ ${evalPackages.lib.optionalString (subDir != "") "cd ${subDir}"}
6870 ${
6971 # If a resolver was fetched use the it instead of the original stack.yaml
70− pkgs.lib.optionalString (fetchedResolver != null)
72+ evalPackages.lib.optionalString (fetchedResolver != null)
7173 # Replace the resolver path in the stack.yaml with the fetched version
7274 ''
7375 rm ${stackYaml}
@@ -75,7 +77,7 @@ let
7577 chmod +w ${stackYaml}
7678 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
7779 ''}
78− ${pkgs.lib.optionalString (cache != null) ''
80+ ${evalPackages.lib.optionalString (cache != null) ''
7981 cp ${mkCacheFile cache}/.stack-to-nix.cache* $out${subDir'}
8082 ''}
8183 (cd $out${subDir'} && stack-to-nix ${stackToNixArgs})
lib/default.nix+13−14
@@ -4,11 +4,8 @@
44with haskellLib;
55
66let
7− # Why `final.evalPackages.buildPackages.gitMinimal`?
8− # Why not just final.evalPackages.gitMinimal?
9− #
10− # A problem arises when `evalPackages` is `buildPackages`.i
11− # As may be the case in a flake.
7+ # Why `final.buildPackages.buildPackages.gitMinimal`?
8+ # Why not just final.buildPackages.gitMinimal?
129 #
1310 # It turns out `git` depends on `gdb` in a round about way:
1411 # git -> openssh -> libfido2 -> systemd -> python libxml -> Cython -> gdb
@@ -24,7 +21,7 @@ let
2421 # * When `gdb` does not exist for `js`, so when cross
2522 # compiling with ghcjs `final.buildPackages.git` fails
2623 # to build at all.
27− inherit (pkgs.evalPackages.buildPackages) gitMinimal;
24+ inherit (pkgs.buildPackages.buildPackages) gitMinimal;
2825
2926in {
3027 # Within the package components, these are the attribute names of
@@ -202,7 +199,7 @@ in {
202199 cleanGit = import ./clean-git.nix {
203200 inherit lib cleanSourceWith;
204201 git = gitMinimal;
205− inherit (pkgs.evalPackages.buildPackages) runCommand;
202+ inherit (pkgs.buildPackages.buildPackages) runCommand;
206203 };
207204
208205 # Some times it is handy to temporarily use a relative path between git
@@ -260,17 +257,19 @@ in {
260257 && stdenv.buildPlatform == stdenv.hostPlatform
261258 && stdenv.hostPlatform == stdenv.targetPlatform;
262259
263− # Takes a version number or attr set of arguments (for cabalProject)
264− # and converts it to an attr set of arguments. This allows
260+ # Takes a version number, module or list of modules (for cabalProject)
261+ # and converts it to an list of project modules. This allows
265262 # the use of "1.0.0.0" or { version = "1.0.0.0"; ... }
266− versionOrArgsToArgs = versionOrArgs:
267− if lib.isAttrs versionOrArgs
268− then versionOrArgs
269− else { version = versionOrArgs; };
263+ versionOrModToMods = versionOrMod:
264+ if lib.isString versionOrMod
265+ then [{ version = versionOrMod; }]
266+ else if lib.isList versionOrMod
267+ then versionOrMod
268+ else [versionOrMod];
270269
271270 # Find the resolver in the stack.yaml file and fetch it if a sha256 value is provided
272271 fetchResolver = import ./fetch-resolver.nix {
273− inherit (pkgs.evalPackages) pkgs;
272+ inherit (pkgs.buildPackages) pkgs;
274273 };
275274
276275 inherit (import ./cabal-project-parser.nix {
lib/ghcjs-project.nix−1
@@ -50,7 +50,6 @@
5050 cabalProjectLocal = ''
5151 constraints: Cabal <3.2.1.0
5252 '';
53− modules = [{ reinstallableLibGhc = true; }];
5453 materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
5554 }
5655, ...
lib/spdx/licenses.nix+3−3
@@ -1,13 +1,13 @@
11pkgs:
22with builtins; let
3− spdxJson = pkgs.evalPackages.spdx-license-list-data.json or pkgs.evalPackages.spdx-license-list-data;
3+ spdxJson = pkgs.buildPackages.spdx-license-list-data.json or pkgs.buildPackages.spdx-license-list-data;
44 materialized' = ../../materialized + "/spdx-${spdxJson.version}";
55 licensesJSON = fromJSON (replaceStrings
66 [ "\\u0026" "\\u0027" "\\u003d" ]
77 [ "&" "'" "=" ]
8− (readFile "${pkgs.evalPackages.haskell-nix.materialize {
8+ (readFile "${pkgs.buildPackages.haskell-nix.materialize {
99 materialized = if pathExists materialized' then materialized' else null;
10− } (pkgs.evalPackages.runCommand "spdx-json" { inherit (spdxJson) version; } ''
10+ } (pkgs.buildPackages.runCommand "spdx-json" { inherit (spdxJson) version; } ''
1111 mkdir $out
1212 cp ${spdxJson}/json/licenses.json $out
1313 '')
lib/stack-cache-generator.nix+17−14
@@ -1,6 +1,5 @@
11# Generate cache entries for dependencies of package defined in `src`
22
3−{ pkgs, haskellLib }:
43{ src
54, stackYaml ? "stack.yaml"
65, sha256map ? null
@@ -17,10 +16,14 @@
1716 then { location, tag, ...}: branchMap."${location}"."${tag}" or null
1817 else _: null
1918, resolverSha256 ? null
20−, nix-tools ? pkgs.haskell-nix.internal-nix-tools # When building stack projects we use the internal nix-tools (compiled with a fixed GHC version)
19+, nix-tools
20+, evalPackages
2121, ...
22−}:
22+}@args:
2323let
24+ inherit (evalPackages) runCommand;
25+ inherit (evalPackages.haskell-nix) haskellLib;
26+
2427 # We only care about the stackYaml file. If src is a local directory
2528 # we want to avoid recalculating the cache unless the stack.yaml file
2629 # changes.
@@ -36,10 +39,10 @@ let
3639 let
3740 origSrc = if src ? _isLibCleanSourceWith then src.origSrc else src;
3841 origSubDir = if src ? _isLibCleanSourceWithEx then src.origSubDir else "";
39− relPath = pkgs.lib.removePrefix (toString origSrc + origSubDir + "/") path;
42+ relPath = evalPackages.lib.removePrefix (toString origSrc + origSubDir + "/") path;
4043
4144 # checks if path1 is a parent directory for path2
42− isParent = path1: path2: pkgs.lib.hasPrefix "${path1}/" path2;
45+ isParent = path1: path2: evalPackages.lib.hasPrefix "${path1}/" path2;
4346
4447 in
4548 (relPath == stackYaml)
@@ -48,9 +51,9 @@ let
4851 };
4952
5053 # All repos served via ssh or git protocols are usually private
51− private = url: pkgs.lib.substring 0 4 url != "http";
54+ private = url: evalPackages.lib.substring 0 4 url != "http";
5255
53− repos = builtins.fromJSON (builtins.readFile (pkgs.runCommand "stack-repos" {
56+ repos = builtins.fromJSON (builtins.readFile (evalPackages.runCommand "stack-repos" {
5457 buildInputs = [ nix-tools ];
5558 } ''
5659 TMP=$(mktemp -d)
@@ -58,23 +61,23 @@ let
5861 cp -r "${maybeCleanedSource}/." $TMP
5962 chmod -R +w $TMP
6063 substituteInPlace ${stackYaml} --replace "# nix-sha256:" "nix-sha256:"
61− ${pkgs.lib.optionalString (fetchedResolver != null) ''
64+ ${evalPackages.lib.optionalString (fetchedResolver != null) ''
6265 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
6366 ''}
6467 stack-repos --stack-yaml ${stackYaml}
6568 cp repos.json $out
6669 ''));
6770
68− cabalName = path: builtins.readFile (pkgs.runCommand "cabal-name" {
71+ cabalName = path: builtins.readFile (evalPackages.runCommand "cabal-name" {
6972 buildInputs = [ nix-tools ];
7073 } ''
7174 cabal-name ${path} > $out
7275 '');
7376
7477 hashPath = path:
75− builtins.readFile (pkgs.runCommand "hash-path" { preferLocalBuild = true; }
76− "echo -n $(${pkgs.nix}/bin/nix-hash --type sha256 --base32 ${path}) > $out");
77−in with pkgs.lib;
78+ builtins.readFile (evalPackages.runCommand "hash-path" { preferLocalBuild = true; }
79+ "echo -n $(${evalPackages.nix}/bin/nix-hash --type sha256 --base32 ${path}) > $out");
80+in with evalPackages.lib;
7881concatMap (dep:
7982 let
8083 is-private = private dep.url;
@@ -88,13 +91,13 @@ concatMap (dep:
8891 };
8992 pkgsrc =
9093 if !is-private && sha256 != null
91− then pkgs.fetchgit {
94+ then evalPackages.fetchgit {
9295 inherit (dep) url rev;
9396 inherit sha256;
9497 }
9598 else builtins.fetchGit ({
9699 inherit (dep) url rev;
97− } // pkgs.lib.optionalAttrs (branch != null) { ref = branch; });
100+ } // evalPackages.lib.optionalAttrs (branch != null) { ref = branch; });
98101 in map (subdir: {
99102 name = cabalName "${pkgsrc}/${subdir}";
100103 inherit (dep) url rev;
lib/system-nixpkgs-map.nix+1−1
@@ -11,7 +11,7 @@ let
1111 gcclibs = if pkgs.stdenv.hostPlatform.isWindows then [
1212 pkgs.windows.mcfgthreads
1313 # If we just use `pkgs.buildPackages.gcc.cc` here it breaks the `th-dlls` test. TODO figure out why exactly.
14− (pkgs.evalPackages.runCommand "gcc-only" { nativeBuildInputs = [ pkgs.evalPackages.xorg.lndir ]; } ''
14+ (pkgs.buildPackages.runCommand "gcc-only" { nativeBuildInputs = [ pkgs.buildPackages.xorg.lndir ]; } ''
1515 mkdir $out
1616 lndir ${pkgs.buildPackages.gcc.cc} $out
1717 '')
lib/system-pkgs.nix−5
@@ -12,10 +12,5 @@ pkgs:
1212 # Base packages.
1313 pkgs
1414
15− # fetchgit should always come from the evalPackages
16− # if it comes from the targetPackages we won't even
17− # be able to execute it.
18− // { fetchgit = pkgs.evalPackages.fetchgit; }
19−
2015 # Apply the mapping.
2116 // import ./system-nixpkgs-map.nix pkgs
mk-local-hackage-repo/default.nix+1−1
@@ -17,7 +17,7 @@
1717pkgs:
1818{ name, index }:
1919
20−pkgs.evalPackages.runCommand "hackage-repo-${name}" { preferLocalBuild = true; } ''
20+pkgs.buildPackages.runCommand "hackage-repo-${name}" { preferLocalBuild = true; } ''
2121mkdir -p $out
2222export expires="4000-01-01T00:00:00Z"
2323
modules/cabal-project.nix−5
@@ -56,11 +56,6 @@ in {
5656 type = nullOr str;
5757 default = readIfExists config.src "${config.cabalProjectFileName}.freeze";
5858 };
59− caller = mkOption {
60− type = str;
61− default = "callCabalProjectToNix";
62− description = "Name of the calling function for better warning messages";
63− };
6459 ghc = mkOption {
6560 type = nullOr package;
6661 default = null;
modules/component-driver.nix+1−1
@@ -4,7 +4,7 @@ let
44 inherit haskellLib;
55 ghc = config.ghc.package;
66 compiler-nix-name = config.compiler.nix-name;
7− inherit (config) nonReinstallablePkgs hsPkgs compiler;
7+ inherit (config) nonReinstallablePkgs hsPkgs compiler evalPackages;
88 };
99
1010in
modules/hackage-project.nixnew file+60
@@ -0,0 +1,60 @@
1+{ lib, config, pkgs, haskellLib, ... }:
2+let
3+ inherit (config) name revision;
4+ # Lookup latest version in hackage
5+ version = if config.version == "latest"
6+ then builtins.head (
7+ builtins.sort
8+ (a: b: builtins.compareVersions a b > 0)
9+ (builtins.attrNames pkgs.haskell-nix.hackage.${config.name}))
10+ else config.version;
11+in {
12+ _file = "haskell.nix/modules/hackage-project.nix";
13+ options = {
14+ version = lib.mkOption {
15+ type = lib.types.str;
16+ default = "latest";
17+ description = ''Version of the hackage package to use (defaults to "latest")'';
18+ };
19+ revision = lib.mkOption {
20+ type = lib.types.str;
21+ default = "default";
22+ description = ''Hackage revision to use ("default", "r1", "r2", etc.)'';
23+ };
24+ };
25+ config = {
26+ # Avoid readDir and readFile IFD functions looking for these files in the hackage source
27+ # `mkOverride 1100` means this will be used in preference to the mkOption default,
28+ # but a `mkDefault` can still override this.
29+ cabalProject = lib.mkOverride 1100 ''
30+ packages: .
31+ '';
32+ cabalProjectLocal = lib.mkOverride 1100 null;
33+ cabalProjectFreeze = lib.mkOverride 1100 null;
34+ src =
35+ let
36+ tarball = config.evalPackages.fetchurl {
37+ url = "mirror://hackage/${name}-${version}.tar.gz";
38+ inherit (pkgs.haskell-nix.hackage.${name}.${version}) sha256; };
39+ rev = pkgs.haskell-nix.hackage.${name}.${version}.revisions.${revision};
40+ cabalFile = config.evalPackages.fetchurl {
41+ url = "https://hackage.haskell.org/package/${name}-${version}/revision/${toString rev.revNum}.cabal";
42+ inherit (rev) sha256;
43+ };
44+ revSuffix = lib.optionalString (rev.revNum > 0) "-r${toString rev.revNum}";
45+ in config.evalPackages.runCommand "${name}-${version}${revSuffix}-src" {} (''
46+ tmp=$(mktemp -d)
47+ cd $tmp
48+ tar xzf ${tarball}
49+ mv "${name}-${version}" $out
50+ '' + lib.optionalString (rev.revNum > 0) ''
51+ cp ${cabalFile} $out/${name}.cabal
52+ '') // {
53+ # TODO remove once nix >=2.4 is widely adopted (will trigger rebuilds of everything).
54+ # Disable filtering keeps pre ond post nix 2.4 behaviour the same. This means that
55+ # the same `alex`, `happy` and `hscolour` are used to build GHC. It also means that
56+ # that `tools` in the shell will be built the same.
57+ filterPath = { path, ... }: path;
58+ };
59+ };
60+}
overlays/hackage-quirks.nix → modules/hackage-quirks.nixrenamed+22−17
@@ -1,29 +1,36 @@
1−# This overlay adds hackageQuirks to provide suitable default
2−# arguments for `haskell-nix.hackage-project` and the functions
1+# These modules are used by `haskell-nix.hackage-project` and the functions
32# that use it (like `hackage-package`)
43#
5−final: prev:
64let
7− inherit (final) lib;
8−
9−in { haskell-nix = prev.haskell-nix // {
10−
11− hackageQuirks = { name, version }: {
5+ # Easier than importing nixpkgs just for this
6+ mapAttrsToList = f: attrs:
7+ map (name: f name attrs.${name}) (__attrNames attrs);
8+in [(
9+ {config, lib, pkgs, ...}:
10+ { _file = "haskell.nix/overlays/hackage-quirks.nix#cabal-install"; } //
1211 # FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
1312 # but also for
1413 # https://github.com/input-output-hk/haskell.nix/issues/422
15− cabal-install = {
16− cabalProject = ''
14+ lib.mkIf (config.name == "cabal-install") {
15+ cabalProject = lib.mkDefault ''
1716 packages: .
1817 allow-newer: cabal-install:base, *:base, *:template-haskell
1918 '';
2019 modules = [
2120 # Version of of cabal-install in hackage is broken for GHC 8.10.1
22− (lib.optionalAttrs (version == "3.2.0.0") {
23− packages.cabal-install.src = final.haskell-nix.sources.cabal-32 + "/cabal-install";
21+ (lib.optionalAttrs (config.version == "3.2.0.0"
22+ && builtins.compareVersions pkgs.buildPackages.haskell-nix.compiler.${config.compiler-nix-name}.version "8.10.0.0" >= 0) {
23+ packages.cabal-install.src = pkgs.buildPackages.haskell-nix.sources.cabal-32 + "/cabal-install";
2424 })
2525 ];
26− };
26+ })]
27+
28+ # Map the following into modules that use `mkIf` to check the name of the
29+ # hackage package in a way that is lazy enought not to cause infinite recursion
30+ # issues.
31+ ++ mapAttrsToList (n: v: {config, lib, ...}:
32+ { _file = "haskell.nix/overlays/hackage-quirks.nix#${n}"; } //
33+ lib.mkIf (n == config.name) v) {
2734
2835 # TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
2936 # See https://github.com/haskell/haskell-language-server/issues/2969
@@ -59,7 +66,7 @@ in { haskell-nix = prev.haskell-nix // {
5966 flags: +use-pkg-config
6067 '';
6168 modules = [(
62− {pkgs, ...}: final.lib.mkIf pkgs.stdenv.hostPlatform.isMusl {
69+ {pkgs, lib, ...}: lib.mkIf pkgs.stdenv.hostPlatform.isMusl {
6370 # The order of -lssl and -lcrypto is important here
6471 packages.postgrest.configureFlags = [
6572 "--ghc-option=-optl=-lssl"
@@ -78,6 +85,4 @@ in { haskell-nix = prev.haskell-nix // {
7885 ];
7986 };
8087
81− }."${name}" or {};
82−
83−}; }
88+ }
modules/plan.nix+7
@@ -299,6 +299,13 @@ in {
299299 visible = false;
300300 internal = true;
301301 };
302+
303+ evalPackages = mkOption {
304+ type = unspecified;
305+ description = ''
306+ The `evalPackages` that will be used when building `hoogle` and shell tools.
307+ '';
308+ };
302309 };
303310
304311 config = let module = config.plan.pkg-def config.hackage.configs; in {
modules/project-common.nix+35−1
@@ -1,4 +1,4 @@
1−{ lib, ... }:
1+{ lib, config, pkgs, ... }:
22with lib;
33with lib.types;
44{
@@ -24,6 +24,40 @@ with lib.types;
2424 shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
2525 '';
2626 };
27+ evalSystem = mkOption {
28+ type = str;
29+ default = pkgs.buildPackages.system;
30+ description = ''
31+ Specifies the system on which `cabal` and `nix-tools` should run.
32+ If not specified the `buildPackages` system will be used.
33+ If there are no builders for the `buildPackages` system
34+ specifying a system for which there are builders will
35+ allow the evaluation of the haskell project to work.
36+ '';
37+ };
38+ evalPackages = mkOption {
39+ type = attrs;
40+ default =
41+ if pkgs.buildPackages.system == config.evalSystem
42+ then pkgs.buildPackages
43+ else
44+ import pkgs.path {
45+ system = config.evalSystem;
46+ overlays = pkgs.overlays;
47+ };
48+ description = ''
49+ Packages used to run `cabal` and `nix-tools`.
50+ This will default to `pkgs.buildPackages` if it
51+ matches the `evalSystem` (or if `evalSystem` was
52+ not specified).
53+ If a different `evalSystem` was requested, `evalPackages` will
54+ default to be:
55+ import pkgs.path {
56+ system = config.evalSystem;
57+ overlays = pkgs.overlays;
58+ };
59+ '';
60+ };
2761 hsPkgs = lib.mkOption {
2862 type = lib.types.unspecified;
2963 };
modules/stack-project.nix+2−7
@@ -35,14 +35,9 @@ with types;
3535 default = null;
3636 description = "If true the nix files will be generated used to check plan-sha256 and material";
3737 };
38− caller = mkOption {
39− type = str;
40− default = "callCabalProjectToNix";
41− description = "Name of the calling function for better warning messages";
42− };
4338 nix-tools = mkOption {
44− type = nullOr package;
45− default = pkgs.evalPackages.haskell-nix.internal-nix-tools;
39+ type = package;
40+ default = config.evalPackages.haskell-nix.internal-nix-tools; # When building stack projects we use the internal nix-tools (compiled with a fixed GHC version)
4641 description = "nix-tools to use when converting the `plan.json` to nix";
4742 };
4843
overlays/bootstrap.nix+19−11
@@ -879,7 +879,8 @@ in {
879879 # always has `checkMaterialization = false` to avoid infinite
880880 # recursion.
881881 cabal-install-tool = {compiler-nix-name, ...}@args:
882− (final.haskell-nix.hackage-package ({
882+ (final.haskell-nix.hackage-package ({pkgs, ...}: {
883+ evalPackages = pkgs.buildPackages;
883884 name = "cabal-install";
884885 version = "3.6.2.0";
885886 index-state = final.haskell-nix.internalHackageIndexState;
@@ -894,8 +895,8 @@ in {
894895 then "ghc8107"
895896 else args.compiler-nix-name;
896897 project =
897− final.haskell-nix.cabalProject ({
898− caller = "nix-tools-set";
898+ final.haskell-nix.cabalProject ({pkgs, ...}: {
899+ evalPackages = pkgs.buildPackages;
899900 name = "nix-tools";
900901 src = {
901902 outPath = final.haskell-nix.sources.nix-tools;
@@ -1053,8 +1054,6 @@ in {
10531054 # This compiler-nix-name will only be used to build nix-tools and cabal-install
10541055 # when checking materialization of alex, happy and hscolour.
10551056 compiler-nix-name = "ghc865";
1056− nix-tools = final.evalPackages.haskell-nix.nix-tools.${compiler-nix-name};
1057− cabal-install = final.evalPackages.haskell-nix.cabal-install.${compiler-nix-name};
10581057 # The ghc boot compiler to use to compile alex, happy and hscolour
10591058 ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
10601059 ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
@@ -1098,7 +1097,8 @@ in {
10981097 # building ghc itself (since GHC is a dependency
10991098 # of the materialization check it would cause
11001099 # infinite recursion).
1101− alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({
1100+ alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({pkgs, ...}: {
1101+ evalPackages = pkgs.buildPackages;
11021102 version = "3.2.4";
11031103 inherit ghcOverride nix-tools cabal-install index-state;
11041104 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
@@ -1106,23 +1106,31 @@ in {
11061106 } // args);
11071107 alex = bootstrap.packages.alex-tool {};
11081108 alex-unchecked = bootstrap.packages.alex-tool { checkMaterialization = false; };
1109− happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy" ({
1110− inherit version ghcOverride nix-tools cabal-install index-state;
1109+ happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy"
1110+ ({config, pkgs, ...}: {
1111+ evalPackages = pkgs.buildPackages;
1112+ inherit version ghcOverride index-state;
11111113 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}";
11121114 modules = [{ reinstallableLibGhc = false; }];
1113− } // args);
1115+ nix-tools = config.evalPackages.haskell-nix.nix-tools.${compiler-nix-name};
1116+ cabal-install = config.evalPackages.haskell-nix.cabal-install.${compiler-nix-name};
1117+ } // args);
11141118 happy = bootstrap.packages.happy-tool {};
11151119 happy-unchecked = bootstrap.packages.happy-tool { checkMaterialization = false; };
11161120 # Older version needed when building ghc 8.6.5
11171121 happy-old = bootstrap.packages.happy-tool { version = "1.19.11"; };
11181122 happy-old-unchecked = bootstrap.packages.happy-tool { version = "1.19.11"; checkMaterialization = false; };
1119− hscolour-tool = args: (hackage-package ({
1123+ hscolour-tool = args: (hackage-package
1124+ ({config, pkgs, ...}: {
1125+ evalPackages = pkgs.buildPackages;
11201126 compiler-nix-name = buildBootstrapper.compilerNixName;
11211127 name = "hscolour";
11221128 version = "1.24.4";
1123− inherit ghcOverride nix-tools cabal-install index-state;
1129+ inherit ghcOverride index-state;
11241130 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
11251131 modules = [{ reinstallableLibGhc = false; }];
1132+ nix-tools = config.evalPackages.haskell-nix.nix-tools.${compiler-nix-name};
1133+ cabal-install = config.evalPackages.haskell-nix.cabal-install.${compiler-nix-name};
11261134 } // args)).getComponent "exe:HsColour";
11271135 hscolour = bootstrap.packages.hscolour-tool {};
11281136 hscolour-unchecked = bootstrap.packages.hscolour-tool { checkMaterialization = false; };
overlays/default.nix−4
@@ -6,7 +6,6 @@ let
66 #ghcjs = import ./ghcjs-asterius-triple.nix;
77 #python = import ./python.nix;
88 haskell = import ./haskell.nix args;
9− hackage-quirks = import ./hackage-quirks.nix;
109 bootstrap = import ./bootstrap.nix;
1110 ghc = import ./ghc.nix;
1211 ghc-packages = import ./ghc-packages.nix;
@@ -21,7 +20,6 @@ let
2120 nix-prefetch-git-minimal = import ./nix-prefetch-git-minimal.nix;
2221 gobject-introspection = import ./gobject-introspection.nix;
2322 hix = import ./hix.nix;
24− eval-packages = import ./eval-packages.nix combined;
2523 ghcjs = import ./ghcjs.nix;
2624 };
2725
@@ -41,7 +39,6 @@ let
4139 })
4240 wine
4341 haskell
44− hackage-quirks
4542 bootstrap
4643 ghc
4744 ghc-packages
@@ -56,7 +53,6 @@ let
5653 ghcjs
5754 gobject-introspection
5855 hix
59− eval-packages
6056 hydra
6157 # Restore nixpkgs haskell and haskellPackages
6258 (_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; })
overlays/eval-packages.nixdeleted−14
@@ -1,14 +0,0 @@
1−haskellNixOverlay: final: prev: {
2− # This overlay makes `evalPackages` is like `buildPackages`, but on
3− # `builtins.currentSystem` (when not building a nix flake).
4− # We do not pass the `config` or `overlays` (not in `final.haskell-nix.overlays`).
5− # This could cause flake and non flake builds to diverge, although only the
6− # derivations that use `evalPackages` (these should be eval time only derviations
7− # used to build nix inputs for IFD, the generated nix should match and so derivations
8− # that depend on the IFD should match).
9− evalPackages = import final.path {
10− # If we are building a flake there will be no currentSystem attribute
11− system = builtins.currentSystem or final.buildPackages.system;
12− overlays = [ haskellNixOverlay ];
13− };
14−}
overlays/ghc-packages.nix+8−7
@@ -1,13 +1,13 @@
11final: prev:
22let
3− callCabal2Nix = compiler-nix-name: name: src: final.evalPackages.stdenv.mkDerivation {
3+ callCabal2Nix = compiler-nix-name: name: src: final.buildPackages.stdenv.mkDerivation {
44 name = "${name}-package.nix";
55 inherit src;
66 nativeBuildInputs = [
77 # It is not safe to check the nix-tools materialization here
88 # as we would need to run this code to do so leading to
99 # infinite recursion (so using nix-tools-unchecked).
10− final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name}
10+ final.buildPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name}
1111 ];
1212 phases = [ "unpackPhase" "buildPhase" ];
1313
@@ -32,7 +32,7 @@ let
3232 name = name + ext;
3333 inherit path;
3434 }) files);
35− in final.evalPackages.runCommand "${name}${ext}" {} ''
35+ in final.buildPackages.runCommand "${name}${ext}" {} ''
3636 cp -Lr ${links} $out
3737 chmod -R +w $out
3838 '';
@@ -117,14 +117,14 @@ in rec {
117117 let nix24srcFix = src: src // { filterPath = { path, ... }: path; };
118118 # Add in the generated files needed by ghc-boot
119119 in if subDir == "libraries/ghc-boot"
120− then nix24srcFix (final.evalPackages.runCommand "ghc-boot-src" { nativeBuildInputs = [final.evalPackages.xorg.lndir]; } ''
120+ then nix24srcFix (final.buildPackages.runCommand "ghc-boot-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
121121 mkdir $out
122122 lndir -silent ${ghc.passthru.configured-src}/${subDir} $out
123123 lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC
124124 '')
125125 else if subDir == "compiler"
126126 then final.haskell-nix.haskellLib.cleanSourceWith {
127− src = nix24srcFix (final.evalPackages.runCommand "ghc-src" { nativeBuildInputs = [final.evalPackages.xorg.lndir]; } ''
127+ src = nix24srcFix (final.buildPackages.runCommand "ghc-src" { nativeBuildInputs = [final.buildPackages.xorg.lndir]; } ''
128128 mkdir $out
129129 lndir -silent ${ghc.passthru.configured-src} $out
130130 if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs ]]; then
@@ -213,7 +213,8 @@ in rec {
213213
214214 # A `cabalProject'` project for each ghc
215215 ghc-extra-projects = builtins.mapAttrs (ghcName: proj:
216− final.haskell-nix.cabalProject' {
216+ final.haskell-nix.cabalProject' ({pkgs, ...}: {
217+ evalPackages = pkgs.buildPackages;
217218 name = "ghc-extra-projects-${ghc-extra-projects-type}-${ghcName}";
218219 src = proj;
219220 inherit (proj) cabalProject;
@@ -227,7 +228,7 @@ in rec {
227228 compiler-nix-name = ghcName;
228229 configureArgs = "--disable-tests --disable-benchmarks --allow-newer='terminfo:base'"; # avoid failures satisfying bytestring package tests dependencies
229230 modules = [{ reinstallableLibGhc = false; }];
230− })
231+ }))
231232 ghc-extra-pkgs-cabal-projects;
232233
233234 # The packages from the project for each ghc
overlays/haskell.nix+32−74
@@ -189,7 +189,7 @@ final: prev: {
189189 hackageTarball = { index-state, sha256, nix-tools ? final.haskell-nix.nix-tools, ... }:
190190 assert sha256 != null;
191191 let at = builtins.replaceStrings [":"] [""] index-state; in
192− { "hackage.haskell.org-at-${at}" = final.evalPackages.fetchurl {
192+ { "hackage.haskell.org-at-${at}" = final.fetchurl {
193193 name = "01-index.tar.gz-at-${at}";
194194 url = "https://hackage.haskell.org/01-index.tar.gz";
195195 downloadToTemp = true;
@@ -211,7 +211,7 @@ final: prev: {
211211 # dotCabalName anyway.
212212 dotCabalName = "dot-cabal-" + allNames;
213213 # This is very big, and cheap to build: prefer building it locally
214− tarballRepos = final.evalPackages.runCommand dotCabalName { nativeBuildInputs = [ cabal-install ]; preferLocalBuild = true; } ''
214+ tarballRepos = final.runCommand dotCabalName { nativeBuildInputs = [ cabal-install ]; preferLocalBuild = true; } ''
215215 mkdir -p $out/.cabal
216216 cat <<EOF > $out/.cabal/config
217217 ${final.lib.concatStrings (
@@ -239,7 +239,7 @@ final: prev: {
239239 '';
240240 in
241241 # Add the extra-hackage-repos where we have all the files needed.
242− final.evalPackages.runCommand dotCabalName { nativeBuildInputs = [ final.evalPackages.xorg.lndir ]; } ''
242+ final.runCommand dotCabalName { nativeBuildInputs = [ final.xorg.lndir ]; } ''
243243 mkdir $out
244244 lndir ${tarballRepos} $out
245245
@@ -261,10 +261,9 @@ final: prev: {
261261
262262 # Helps materialize the output of derivations
263263 materialize = import ../lib/materialize.nix {
264− inherit (final.evalPackages) nix;
264+ pkgs = final;
265+ inherit (final) nix runCommand writeShellScript;
265266 inherit (final.haskell-nix) checkMaterialization;
266− pkgs = final.evalPackages.pkgs;
267− inherit (final.evalPackages.pkgs) runCommand writeShellScript;
268267 };
269268
270269 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
@@ -275,11 +274,7 @@ final: prev: {
275274 };
276275
277276 # Function to call stackToNix
278− callStackToNix = import ../lib/call-stack-to-nix.nix {
279− pkgs = final.evalPackages.pkgs;
280− inherit (final.evalPackages.pkgs) runCommand;
281− inherit (final.evalPackages.haskell-nix) mkCacheFile materialize haskellLib;
282− };
277+ callStackToNix = import ../lib/call-stack-to-nix.nix;
283278
284279 # given a source location call `cabal-to-nix` (from nix-tools) on it
285280 # to produce the nix representation of it.
@@ -325,7 +320,7 @@ final: prev: {
325320 # pkgs.fetchgit doesn't have any way of fetching from a given
326321 # ref.
327322 assert isNull ref;
328− final.evalPackages.fetchgit {
323+ final.fetchgit {
329324 url = url;
330325 rev = rev;
331326 sha256 = sha256;
@@ -382,10 +377,7 @@ final: prev: {
382377 }
383378 '';
384379
385− genStackCache = import ../lib/stack-cache-generator.nix {
386− inherit (final.evalPackages) pkgs;
387− inherit (final.evalPackages.haskell-nix) haskellLib;
388− };
380+ genStackCache = import ../lib/stack-cache-generator.nix;
389381
390382 mkCacheModule = cache:
391383 # for each item in the `cache`, set
@@ -414,7 +406,7 @@ final: prev: {
414406 final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
415407 )
416408 else
417− final.evalPackages.fetchgit { inherit url rev sha256; };
409+ final.fetchgit { inherit url rev sha256; };
418410 } // final.buildPackages.lib.optionalAttrs (subdir != null && subdir != ".") { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
419411 };
420412
@@ -428,11 +420,9 @@ final: prev: {
428420 # Resulting nix files are added to nix-plan subdirectory.
429421 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
430422 index-state-hashes = import indexStateHashesPath;
431− inherit (final.buildPackages.haskell-nix) haskellLib materialize;
423+ inherit (final.buildPackages.haskell-nix) haskellLib;
432424 pkgs = final.buildPackages.pkgs;
433− inherit (final) evalPackages;
434− inherit (final.evalPackages.haskell-nix) dotCabal;
435− inherit (final.buildPackages.pkgs) runCommand symlinkJoin cacert;
425+ inherit (final.buildPackages.pkgs) runCommand cacert;
436426 };
437427
438428 # Loads a plan and filters the package directories using cleanSourceWith
@@ -455,60 +445,22 @@ final: prev: {
455445 # the index-state-hashes is used. This guarantees reproducibility wrt
456446 # to the haskell.nix revision. If reproducibility beyond haskell.nix
457447 # is required, a specific index-state should be provided!
458− hackage-package =
459− { name, compiler-nix-name, ... }@args':
460− let args = { caller = "hackage-package"; } // args';
461− in (hackage-project args).getPackage name;
462− hackage-project =
463− { name
464− , compiler-nix-name
465− , version ? "latest"
466− , revision ? "default"
467− , ... }@args':
468− let version' = if version == "latest"
469− then builtins.head (
470− builtins.sort
471− (a: b: builtins.compareVersions a b > 0)
472− (builtins.attrNames hackage.${name}))
473− else version;
474− args = { caller = "hackage-project"; } // args';
475− tarball = final.pkgs.fetchurl {
476− url = "mirror://hackage/${name}-${version'}.tar.gz";
477− inherit (hackage.${name}.${version'}) sha256; };
478− rev = hackage.${name}.${version'}.revisions.${revision};
479− cabalFile = final.pkgs.fetchurl {
480− url = "https://hackage.haskell.org/package/${name}-${version'}/revision/${toString rev.revNum}.cabal";
481− inherit (rev) sha256;
482− };
483− revSuffix = final.lib.optionalString (rev.revNum > 0) "-r${toString rev.revNum}";
484− in let src = final.buildPackages.pkgs.runCommand "${name}-${version'}${revSuffix}-src" {} (''
485− tmp=$(mktemp -d)
486− cd $tmp
487− tar xzf ${tarball}
488− mv "${name}-${version'}" $out
489− '' + final.lib.optionalString (rev.revNum > 0) ''
490− cp ${cabalFile} $out/${name}.cabal
491− '') // {
492− # TODO remove once nix >=2.4 is widely adopted (will trigger rebuilds of everything).
493− # Disable filtering keeps pre ond post nix 2.4 behaviour the same. This means that
494− # the same `alex`, `happy` and `hscolour` are used to build GHC. It also means that
495− # that `tools` in the shell will be built the same.
496− filterPath = { path, ... }: path;
497− };
498− in cabalProject' ({
499− # Avoid readDir and readFile IFD functions looking for these files in the hackage source
500− cabalProject = null; cabalProjectLocal = null; cabalProjectFreeze = null;
501− } // final.haskell-nix.hackageQuirks { inherit name; version = version'; } //
502− builtins.removeAttrs args [ "version" "revision" ] // { inherit src; });
448+ hackage-package = projectModule:
449+ let project = hackage-project projectModule;
450+ in project.getPackage project.args.name;
451+ hackage-project = projectModule:
452+ cabalProject' ([
453+ (import ../modules/hackage-project.nix)
454+ ] ++ (import ../modules/hackage-quirks.nix)
455+ ++ (if builtins.isList projectModule then projectModule else [projectModule]));
503456
504457 # This function is like `cabalProject` but it makes the plan-nix available
505458 # separately from the hsPkgs. The advantage is that the you can get the
506459 # plan-nix without building the project.
507460 cabalProject' =
508461 projectModule: haskellLib.evalProjectModule ../modules/cabal-project.nix projectModule (
509− { src, compiler-nix-name, ... }@args':
462+ { src, compiler-nix-name, evalPackages, ... }@args:
510463 let
511− args = { caller = "cabalProject'"; } // args';
512464 callProjectResults = callCabalProjectToNix args;
513465 plan-pkgs = importAndFilterProject {
514466 inherit (callProjectResults) projectNix sourceRepos src;
@@ -522,6 +474,7 @@ final: prev: {
522474 config = {
523475 compiler.nix-name = compiler-nix-name;
524476 hsPkgs = {};
477+ inherit evalPackages;
525478 };
526479 }
527480 else mkCabalProjectPkgSet
@@ -531,7 +484,10 @@ final: prev: {
531484 ++ (args.modules or [])
532485 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
533486 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
534− ++ [ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; } ];
487+ ++ [ {
488+ compiler.nix-name = final.lib.mkForce args.compiler-nix-name;
489+ evalPackages = final.lib.mkDefault evalPackages;
490+ } ];
535491 extra-hackages = args.extra-hackages or [] ++ callProjectResults.extra-hackages;
536492 };
537493
@@ -708,7 +664,7 @@ final: prev: {
708664 # not exist at all). The derivation will never build
709665 # and simple outputs the result of cabal configure.
710666 getComponent = componentName:
711− final.evalPackages.runCommand "cabal-configure-error" {
667+ final.rawProject.config.evalPackages.runCommand "cabal-configure-error" {
712668 passthru = {
713669 inherit project package;
714670 };
@@ -807,7 +763,7 @@ final: prev: {
807763
808764 stackProject' =
809765 projectModule: haskellLib.evalProjectModule ../modules/stack-project.nix projectModule (
810− { src, ... }@args:
766+ { src, evalPackages, ... }@args:
811767 let callProjectResults = callStackToNix (args
812768 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
813769 generatedCache = genStackCache args;
@@ -824,7 +780,8 @@ final: prev: {
824780 ++ (args.modules or [])
825781 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
826782 ++ final.lib.optional (args.compiler-nix-name != null)
827− { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; };
783+ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; }
784+ ++ [ { evalPackages = final.lib.mkDefault evalPackages; } ];
828785 };
829786
830787 project = addProjectAndPackageAttrs {
@@ -860,6 +817,7 @@ final: prev: {
860817 (import ../modules/stack-project.nix)
861818 (import ../modules/cabal-project.nix)
862819 (import ../modules/project.nix)
820+ {_module.args.pkgs = final;} # Needed to make `src = config.evalPackages.haskell-nix.haskellLib.cleanGit ...` work
863821 ] ++ projectModule';
864822 }).config) src projectFileName;
865823 dir = __readDir (src.origSrcSubDir or src);
@@ -881,12 +839,12 @@ final: prev: {
881839 if final.lib.hasSuffix ".yaml" selectedFileName
882840 then stackProject' ([
883841 (import ../modules/project.nix)
884− { caller = "project'"; stackYaml = selectedFileName; }
842+ { stackYaml = selectedFileName; }
885843 ] ++ projectModule'
886844 )
887845 else cabalProject' ([
888846 (import ../modules/project.nix)
889− { caller = "project'"; cabalProjectFileName = selectedFileName; }
847+ { cabalProjectFileName = selectedFileName; }
890848 ] ++ projectModule');
891849
892850 # This is the same as the `cabalPackage` and `stackPackage` wrappers
overlays/hix.nix+3−3
@@ -39,13 +39,13 @@ final: prev: { haskell-nix = prev.haskell-nix // { hix = {
3939 (import ../modules/hix-project.nix)
4040 projectDefaults
4141 commandArgs'
42− {
42+ ({config, ...}: {
4343 src =
4444 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
45− then final.haskell-nix.haskellLib.cleanGit {
45+ then config.evalPackages.haskell-nix.haskellLib.cleanGit {
4646 inherit src name;
4747 }
4848 else src;
49− }
49+ })
5050 ];
5151}; }; }
overlays/nix-prefetch-git-minimal.nix+14
@@ -21,6 +21,20 @@ final: prev: {
2121 git = final.gitMinimal;
2222 }) nix-prefetch-git;
2323
24+ # fetchgit use `buildPackages.gitMinimal` and on nixpkgs 21.11
25+ # and earlier that causes problems when cross compiling.
26+ # Adding an extra `buildPackages` works around this.
27+ # To check for the issue run the following in `nixpkgs`:
28+ # nix-diff $(nix-instantiate -A gitMinimal) $(nix-instantiate -A pkgsCross.mingwW64.buildPackages.gitMinimal)
29+ # These two derivations should really be the same and
30+ # on nixpkgs-unstable and 22.05 they are now, but it looks
31+ # like that might be because the dependency on libredirect
32+ # was changed.
33+ # See https://github.com/NixOS/nixpkgs/pull/182143
34+ libredirect = prev.libredirect.overrideAttrs (attrs: {
35+ libName = "libredirect" + final.stdenv.hostPlatform.extensions.sharedLibrary;
36+ });
37+
2438 # Find uses of the non minimal git package by uncommenting this:
2539 # git = prev.intentional-error-here;
2640 # gitMinimal = final.gitAndTools.git.override {
overlays/tools.nix+25−43
@@ -57,50 +57,32 @@ in { haskell-nix = prev.haskell-nix // {
5757 cabal-install = "cabal";
5858 };
5959
60− hackage-tool = { name, ... }@args':
60+ hackage-tool = projectModules:
6161 let
62− args = { caller = "hackage-tool"; } // args';
63− in
64− (final.haskell-nix.hackage-package
65− ( # Disable benchmarks and tests by default (since we only want the exe component)
66− { configureArgs = "--disable-benchmarks --disable-tests"; }
67− // args
68− // { name = final.haskell-nix.toolPackageName.${name} or name; }))
69− .getComponent "exe:${final.haskell-nix.packageToolName.${name} or name}";
62+ package = final.haskell-nix.hackage-package (projectModules ++ [
63+ ({lib, ...}: {
64+ options.name = lib.mkOption {
65+ apply = n: final.haskell-nix.toolPackageName.${n} or n;
66+ };
67+ config = {
68+ # Disable benchmarks and tests by default (since we only want the exe component)
69+ configureArgs = "--disable-benchmarks --disable-tests";
70+ };
71+ })
72+ ]);
73+ name = package.project.args.name;
74+ exeName = final.haskell-nix.packageToolName.${name} or name;
75+ in package.getComponent "exe:${exeName}";
7076
71− tool = compiler-nix-name: name: versionOrArgs:
72− let
73− args' = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
74− args = { inherit compiler-nix-name; } // args';
75− in
76− (if final.haskell-nix.custom-tools ? "${name}"
77− && final.haskell-nix.custom-tools."${name}" ? "${args.version}"
78− then final.haskell-nix.custom-tools."${name}"."${args.version}"
79− else final.haskell-nix.hackage-tool) (args // { inherit name; });
80−
81− tools = compiler-nix-name: lib.mapAttrs (final.haskell-nix.tool compiler-nix-name);
77+ tool = compiler-nix-name: name: versionOrMod:
78+ final.haskell-nix.hackage-tool (
79+ final.haskell-nix.haskellLib.versionOrModToMods versionOrMod
80+ ++ [{ inherit compiler-nix-name name; }]
81+ );
8282
83− # Like `tools` but allows default ghc to be specified
84− toolsForGhc = ghcOverride: toolSet:
85− final.haskell-nix.tools (
86− lib.mapAttrs (name: versionOrArgs:
87− let args = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
88− in
89− # Add default ghc if not specified in the args
90− (lib.optionalAttrs (!(args ? "compiler-nix-name" || args ? "ghc"))
91− { inherit ghcOverride; }
92− ) // args
93− ) toolSet
94− );
95−
96− # Tools not in hackage yet
97− # When adding custom tools here, consider adding them
98− # to the `tools` attribute defined in `build.nix` to make
99− # sure they are cached.
100− custom-tools = {
101− # Currently everything we want is in hackage.
102− # Before adding anything here consider uploading to hackage instead.
103− # If that is not possible look at the git history of this file to see examples
104− # of how to add a custom-tool.
105− };
83+ tools = evalPackages: compiler-nix-name:
84+ lib.mapAttrs (name: versionOrMod:
85+ final.haskell-nix.hackage-tool (
86+ final.haskell-nix.haskellLib.versionOrModToMods versionOrMod
87+ ++ [{ inherit evalPackages compiler-nix-name name; }]));
10688}; }
test/buildable/default.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "buildable";
99 modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
1010 };
test/builder-haddock/default.nix+3−1
@@ -1,4 +1,4 @@
1−{ mkCabalProjectPkgSet, stdenv, lib, testSrc, compiler-nix-name }:
1+{ mkCabalProjectPkgSet, stdenv, lib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
@@ -23,6 +23,8 @@ let
2323 # Check that the package option works
2424 packages.stm.doHaddock = false;
2525 }
26+
27+ { inherit evalPackages; }
2628 ];
2729 };
2830
test/c-ffi/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -13,7 +13,7 @@ let
1313 ];
1414
1515 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
1717 src = testSrc "c-ffi";
1818 inherit modules;
1919 };
test/ca-derivations-include/default.nix+3−3
@@ -1,6 +1,6 @@
11# Build a project enabling content addressed derivations for
22# only a subset of the components
3−{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, CADerivationsEnabled }:
3+{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:
44
55with lib;
66
@@ -15,13 +15,13 @@ let
1515
1616 # each derivation is content addressed
1717 projectA = project' {
18− inherit compiler-nix-name src cabalProject;
18+ inherit compiler-nix-name evalPackages src cabalProject;
1919 modules = [{ contentAddressed = true; }];
2020 };
2121
2222 # each derivation but one (the executable) is content addressed
2323 projectB = project' {
24− inherit compiler-nix-name src cabalProject;
24+ inherit compiler-nix-name evalPackages src cabalProject;
2525 modules = [{
2626 contentAddressed = true;
2727 packages.cabal-simple.components.exes.cabal-simple.contentAddressed = false;
test/ca-derivations/default.nix+3−3
@@ -1,6 +1,6 @@
11# Test if derivations are content addressed building two derivations producing
22# the same outputs and checking if the path stores are equals
3−{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, CADerivationsEnabled }:
3+{ stdenv, pkgs, lib, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, CADerivationsEnabled }:
44
55with lib;
66
@@ -21,13 +21,13 @@ let
2121 '';
2222
2323 projectPlain = project' {
24− inherit compiler-nix-name cabalProject;
24+ inherit compiler-nix-name evalPackages cabalProject;
2525 src = srcPlain;
2626 modules = [{ contentAddressed = true; }];
2727 };
2828
2929 projectWithComment = project' {
30− inherit compiler-nix-name cabalProject;
30+ inherit compiler-nix-name evalPackages cabalProject;
3131 src = srcWithComment;
3232 modules = [{ contentAddressed = true; }];
3333 };
test/cabal-22/default.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "cabal-22";
99 };
1010
test/cabal-doctests/default.nix+2−2
@@ -1,12 +1,12 @@
11# Test a package set
2−{ stdenv, lib, util, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, buildPackages }:
2+{ stdenv, lib, util, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages, buildPackages }:
33
44with lib;
55
66let
77 project =
88 cabalProject' {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
1010 src = testSrc "cabal-doctests";
1111 index-state = "2021-01-11T00:00:00Z";
1212 };
test/cabal-hpack/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -13,7 +13,7 @@ let
1313 ];
1414
1515 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
1717 src = testSrc "cabal-hpack";
1818 inherit modules;
1919 };
test/cabal-simple-debug/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test a package set
2−{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, dwarfdump }:
2+{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, dwarfdump }:
33
44with lib;
55
66let
77 project = cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "cabal-simple-debug";
1010 cabalProject = ''
1111 packages: .
test/cabal-simple-prof/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -16,7 +16,7 @@ let
1616 ];
1717
1818 project = cabalProject' {
19− inherit compiler-nix-name;
19+ inherit compiler-nix-name evalPackages;
2020 src = testSrc "cabal-simple-prof";
2121 inherit modules;
2222 cabalProject = ''
test/cabal-simple/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -13,7 +13,7 @@ let
1313 ];
1414
1515 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
1717 src = testSrc "cabal-simple";
1818 inherit modules;
1919 cabalProject = ''
test/cabal-source-repo-comments/default.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "cabal-source-repo-comments";
99 };
1010 packages = project.hsPkgs;
test/cabal-source-repo/default.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "cabal-source-repo";
99 };
1010 packages = project.hsPkgs;
test/cabal-sublib/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -14,7 +14,7 @@ let
1414
1515 # The ./pkgs.nix works for linux & darwin, but not for windows
1616 project = cabalProject' {
17− inherit compiler-nix-name;
17+ inherit compiler-nix-name evalPackages;
1818 src = testSrc "cabal-sublib";
1919 inherit modules;
2020 cabalProject = ''
test/call-cabal-project-to-nix/default.nix+3−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, buildPackages, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
@@ -6,7 +6,7 @@ let
66 # This test could use cabalProject', but it does so that it
77 # tests using callCabalProjectToNix and importAndFilterProject
88 callProjectResults = callCabalProjectToNix {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
1010 # reuse the cabal-simple test project
1111 src = testSrc "cabal-simple";
1212 cabalProject = ''
@@ -18,6 +18,7 @@ let
1818 plan-pkgs = importAndFilterProject {
1919 inherit (callProjectResults) projectNix sourceRepos src;
2020 };
21+ modules = [{ inherit evalPackages; }];
2122 };
2223 packages = pkgSet.config.hsPkgs;
2324
test/call-stack-to-nix/default.nix+3−2
@@ -1,15 +1,16 @@
1−{ stdenv, lib, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 callProjectResults = callStackToNix {
77 src = testSrc "stack-simple";
8+ inherit evalPackages;
89 };
910 pkgSet = mkStackPkgSet {
1011 stack-pkgs = importAndFilterProject callProjectResults;
1112 pkg-def-extras = [];
12− modules = [];
13+ modules = [{inherit evalPackages;}];
1314 };
1415 packages = pkgSet.config.hsPkgs;
1516
test/coverage-golden/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, fetchFromGitHub, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, buildPackages, sources }:
1+{ stdenv, lib, fetchFromGitHub, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages, buildPackages, sources }:
22
33with lib;
44
@@ -9,7 +9,7 @@ let
99 inherit (buildPackages.buildPackages) jq git;
1010
1111 hpc-coveralls-exes = (buildPackages.haskell-nix.project' {
12− inherit compiler-nix-name;
12+ inherit compiler-nix-name evalPackages;
1313 src = sources.hpc-coveralls;
1414 }).hsPkgs.hpc-coveralls.components.exes;
1515
test/coverage-no-libs/default.nix+2−1
@@ -1,9 +1,10 @@
1−{ stdenv, lib, cabal-install, cabalProject', stackProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabal-install, cabalProject', stackProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 projectArgs = {
7+ inherit evalPackages;
78 src = testSrc "coverage-no-libs";
89 modules = [{
910 # Package has no exposed modules which causes
test/coverage/default.nix+2−1
@@ -1,9 +1,10 @@
1−{ stdenv, lib, cabal-install, cabalProject', stackProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabal-install, cabalProject', stackProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 projectArgs = {
7+ inherit evalPackages;
78 src = testSrc "coverage";
89 modules = [{
910 # Package has no exposed modules which causes
test/default.nix+52−51
@@ -7,6 +7,7 @@
77 permittedInsecurePackages = ["libdwarf-20210528" "libdwarf-20181024" "dwarfdump-20181024"];
88 };
99 }
10+, evalPackages ? import pkgs.path nixpkgsArgs
1011, ifdLevel ? 1000
1112, compiler-nix-name
1213, CADerivationsEnabled ? false
@@ -53,7 +54,7 @@ let
5354 else val
5455 );
5556
56− util = import ./util.nix { cabal-install = pkgs.evalPackages.haskell-nix.cabal-install.${compiler-nix-name}; };
57+ util = import ./util.nix { cabal-install = pkgs.buildPackages.haskell-nix.cabal-install.${compiler-nix-name}; };
5758
5859 # Map the values in an association list over the withIfdInputs function.
5960 #
@@ -144,21 +145,21 @@ let
144145 then filterNonIfdInputsValues attrs
145146 else attrs;
146147
147− testSrcRoot = haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; };
148+ testSrcRoot = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; };
148149 testSrc = subDir: haskell-nix.haskellLib.cleanSourceWith { src = testSrcRoot; inherit subDir; };
149150 # Use the following reproduce issues that may arise on hydra as a
150151 # result of building a snapshot not a git repo.
151152 # testSrcRoot = pkgs.copyPathToStore ./.;
152153 # testSrc = subDir: testSrcRoot + "/${subDir}";
153− testSrcRootWithGitDir = haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; includeSiblings = true; keepGitDir = true; };
154+ testSrcRootWithGitDir = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; includeSiblings = true; keepGitDir = true; };
154155 testSrcWithGitDir = subDir: haskell-nix.haskellLib.cleanSourceWith { src = testSrcRootWithGitDir; inherit subDir; includeSiblings = true; };
155− callTest = x: args: haskell-nix.callPackage x (args // { inherit testSrc; });
156+ callTest = x: args: haskell-nix.callPackage x (args // { inherit testSrc compiler-nix-name evalPackages; });
156157
157158 # Run unit tests with: nix-instantiate --eval --strict -A unit.tests
158159 # An empty list means success.
159160 unitTests =
160161 let
161− tests = haskell-nix.callPackage ./unit.nix { inherit compiler-nix-name; };
162+ tests = haskell-nix.callPackage ./unit.nix { inherit compiler-nix-name evalPackages; };
162163 testsFailedEcho = lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests;
163164 testsFinalLine = if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1";
164165 testsScript = testsFailedEcho + testsFinalLine;
@@ -167,53 +168,53 @@ let
167168
168169 # All tests.
169170 allTests = {
170− cabal-simple = callTest ./cabal-simple { inherit util compiler-nix-name; };
171− cabal-simple-debug = callTest ./cabal-simple-debug { inherit util compiler-nix-name; };
172− cabal-simple-prof = callTest ./cabal-simple-prof { inherit util compiler-nix-name; };
173− cabal-sublib = callTest ./cabal-sublib { inherit util compiler-nix-name; };
174− with-packages = callTest ./with-packages { inherit util compiler-nix-name; };
175− builder-haddock = callTest ./builder-haddock { inherit compiler-nix-name; };
176− stack-simple = callTest ./stack-simple { inherit compiler-nix-name; };
177− stack-local-resolver = callTest ./stack-local-resolver { inherit compiler-nix-name; };
178− stack-local-resolver-subdir = callTest ./stack-local-resolver-subdir { inherit compiler-nix-name; };
179− stack-remote-resolver = callTest ./stack-remote-resolver { inherit compiler-nix-name; };
180− shell-for-setup-deps = callTest ./shell-for-setup-deps { inherit compiler-nix-name; };
181− setup-deps = import ./setup-deps { inherit pkgs compiler-nix-name; };
182− callStackToNix = callTest ./call-stack-to-nix { inherit compiler-nix-name; };
183− callCabalProjectToNix = callTest ./call-cabal-project-to-nix { inherit compiler-nix-name; };
184− cabal-source-repo = callTest ./cabal-source-repo { inherit compiler-nix-name; };
185− cabal-source-repo-comments = callTest ./cabal-source-repo-comments { inherit compiler-nix-name; };
186− buildable = callTest ./buildable { inherit compiler-nix-name; };
187− project-flags-cabal = callTest ./project-flags/cabal.nix { inherit compiler-nix-name; };
188− project-flags-stack = callTest ./project-flags/stack.nix { inherit compiler-nix-name; };
189− ghc-options-cabal = callTest ./ghc-options/cabal.nix { inherit compiler-nix-name; };
190− ghc-options-stack = callTest ./ghc-options/stack.nix { inherit compiler-nix-name; };
191− exe-only = callTest ./exe-only { inherit util compiler-nix-name; };
192− stack-source-repo = callTest ./stack-source-repo { inherit compiler-nix-name; };
193− cabal-doctests = callTest ./cabal-doctests { inherit util compiler-nix-name; };
194− extra-hackage = callTest ./extra-hackage { inherit compiler-nix-name; };
195− ghcjs-overlay = callTest ./ghcjs-overlay { inherit compiler-nix-name; };
196− hls-cabal = callTest ./haskell-language-server/cabal.nix { inherit compiler-nix-name; };
197− hls-stack = callTest ./haskell-language-server/stack.nix { inherit compiler-nix-name; };
198− cabal-hpack = callTest ./cabal-hpack { inherit util compiler-nix-name; };
199− index-state = callTest ./index-state { inherit compiler-nix-name; };
200− sha256map = callTest ./sha256map { inherit compiler-nix-name; };
171+ cabal-simple = callTest ./cabal-simple { inherit util; };
172+ cabal-simple-debug = callTest ./cabal-simple-debug { inherit util; };
173+ cabal-simple-prof = callTest ./cabal-simple-prof { inherit util; };
174+ cabal-sublib = callTest ./cabal-sublib { inherit util; };
175+ with-packages = callTest ./with-packages { inherit util; };
176+ builder-haddock = callTest ./builder-haddock {};
177+ stack-simple = callTest ./stack-simple {};
178+ stack-local-resolver = callTest ./stack-local-resolver {};
179+ stack-local-resolver-subdir = callTest ./stack-local-resolver-subdir {};
180+ stack-remote-resolver = callTest ./stack-remote-resolver {};
181+ shell-for-setup-deps = callTest ./shell-for-setup-deps {};
182+ setup-deps = import ./setup-deps { inherit pkgs evalPackages compiler-nix-name; };
183+ callStackToNix = callTest ./call-stack-to-nix {};
184+ callCabalProjectToNix = callTest ./call-cabal-project-to-nix { inherit evalPackages; };
185+ cabal-source-repo = callTest ./cabal-source-repo {};
186+ cabal-source-repo-comments = callTest ./cabal-source-repo-comments {};
187+ buildable = callTest ./buildable {};
188+ project-flags-cabal = callTest ./project-flags/cabal.nix {};
189+ project-flags-stack = callTest ./project-flags/stack.nix {};
190+ ghc-options-cabal = callTest ./ghc-options/cabal.nix {};
191+ ghc-options-stack = callTest ./ghc-options/stack.nix {};
192+ exe-only = callTest ./exe-only { inherit util; };
193+ stack-source-repo = callTest ./stack-source-repo {};
194+ cabal-doctests = callTest ./cabal-doctests { inherit util; };
195+ extra-hackage = callTest ./extra-hackage {};
196+ ghcjs-overlay = callTest ./ghcjs-overlay {};
197+ hls-cabal = callTest ./haskell-language-server/cabal.nix {};
198+ hls-stack = callTest ./haskell-language-server/stack.nix {};
199+ cabal-hpack = callTest ./cabal-hpack { inherit util; };
200+ index-state = callTest ./index-state {};
201+ sha256map = callTest ./sha256map {};
201202 # fully-static = callTest ./fully-static { inherit (pkgs) buildPackages; };
202− shell-for = callTest ./shell-for { inherit compiler-nix-name; };
203− cabal-22 = callTest ./cabal-22 { inherit util compiler-nix-name; };
204− coverage = callTest ./coverage { inherit compiler-nix-name; };
205− coverage-golden = callTest ./coverage-golden { inherit compiler-nix-name;};
206− coverage-no-libs = callTest ./coverage-no-libs { inherit compiler-nix-name; };
207− snapshots = callTest ./snapshots { inherit compiler-nix-name; };
208− sublib-docs = callTest ./sublib-docs { inherit util compiler-nix-name; };
209− githash = haskell-nix.callPackage ./githash { inherit compiler-nix-name; testSrc = testSrcWithGitDir; };
210− c-ffi = callTest ./c-ffi { inherit util compiler-nix-name; };
211− th-dlls = callTest ./th-dlls { inherit util compiler-nix-name; };
212− external-static-plugin = callTest ./external-static-plugin { inherit compiler-nix-name; };
213− exe-dlls = callTest ./exe-dlls { inherit util compiler-nix-name; };
214− exe-lib-dlls = callTest ./exe-lib-dlls { inherit util compiler-nix-name; };
215− ca-derivations = callTest ./ca-derivations { inherit compiler-nix-name CADerivationsEnabled; };
216− ca-derivations-include = callTest ./ca-derivations-include { inherit compiler-nix-name CADerivationsEnabled; };
203+ shell-for = callTest ./shell-for {};
204+ cabal-22 = callTest ./cabal-22 { inherit util; };
205+ coverage = callTest ./coverage {};
206+ coverage-golden = callTest ./coverage-golden { inherit;};
207+ coverage-no-libs = callTest ./coverage-no-libs {};
208+ snapshots = callTest ./snapshots {};
209+ sublib-docs = callTest ./sublib-docs { inherit util; };
210+ githash = haskell-nix.callPackage ./githash { inherit compiler-nix-name evalPackages; testSrc = testSrcWithGitDir; };
211+ c-ffi = callTest ./c-ffi { inherit util; };
212+ th-dlls = callTest ./th-dlls { inherit util; };
213+ external-static-plugin = callTest ./external-static-plugin {};
214+ exe-dlls = callTest ./exe-dlls { inherit util; };
215+ exe-lib-dlls = callTest ./exe-lib-dlls { inherit util; };
216+ ca-derivations = callTest ./ca-derivations { inherit CADerivationsEnabled; };
217+ ca-derivations-include = callTest ./ca-derivations-include { inherit CADerivationsEnabled; };
217218
218219 unit = unitTests;
219220 };
test/exe-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test building TH code that needs DLLs when cross compiling for windows
2−{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
66let
77 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "exe-dlls";
1010 };
1111
test/exe-lib-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test building TH code that needs DLLs when cross compiling for windows
2−{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
66let
77 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "exe-lib-dlls";
1010 };
1111
test/exe-only/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test a package set
2−{ stdenv, lib, util, haskell-nix, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, haskell-nix, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
66let
77 project = haskell-nix.cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "exe-only";
1010 };
1111
test/external-static-plugin/default.nix+2−2
@@ -1,7 +1,7 @@
1−{ cabalProject', testSrc, compiler-nix-name, recurseIntoAttrs, haskellLib }: let
1+{ cabalProject', testSrc, compiler-nix-name, evalPackages, recurseIntoAttrs, haskellLib }: let
22 project = cabalProject' {
33 src = testSrc "external-static-plugin";
4− inherit compiler-nix-name;
4+ inherit compiler-nix-name evalPackages;
55 modules = [ {
66 packages.prog.components.exes.prog.plugins = [ {
77 inherit (project.hsPkgs.plugin.components) library;
test/extra-hackage/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
@@ -13,7 +13,7 @@ let
1313 demo-src = ./external-package-demo-0.1.0.0.tar.gz;
1414
1515 project = cabalProject' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
1717 src = testSrc "extra-hackage/external-package-user";
1818
1919 extra-hackages = [ hackage ];
test/fully-static/default.nix+5
@@ -3,6 +3,8 @@
33, buildPackages
44, recurseIntoAttrs
55, testSrc
6+, compiler-nix-name
7+, evalPackages
68}:
79
810with lib;
@@ -14,6 +16,7 @@ let
1416
1517 # IFD stack-to-nix
1618 project = { gpl ? true }: stackProject' {
19+ inherit evalPackages;
1720 src = testSrc "fully-static";
1821 pkg-def-extras = [];
1922 modules = [
@@ -28,6 +31,8 @@ let
2831 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
2932
3033in recurseIntoAttrs {
34+ meta.disabled = stdenv.hostPlatform.isGhcjs || compiler-nix-name != "ghc865";
35+
3136 ifdInputs = {
3237 stack-nix-gmp = (project { gpl = true; }).stack-nix;
3338 stack-nix-simple = (project { gpl = false; }).stack-nix;
test/ghc-options/cabal.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "ghc-options";
99 # TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix
1010 modules = [ {
test/ghc-options/stack.nix+2−1
@@ -1,9 +1,10 @@
1−{ stdenv, lib, stackProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, stackProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = stackProject' {
7+ inherit evalPackages;
78 src = testSrc "ghc-options";
89 };
910 packages = project.hsPkgs;
test/ghcjs-overlay/default.nix+2−2
@@ -1,11 +1,11 @@
1−{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
77 src = testSrc "ghcjs-overlay";
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 cabalProjectLocal = lib.optionalString stdenv.hostPlatform.isGhcjs ''
1010 repository ghcjs-overlay
1111 url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/bfc363b9f879c360e0a0460ec0c18ec87222ec32
test/githash/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, haskell-nix, haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, runCommand, gitMinimal, buildPackages }:
1+{ stdenv, lib, haskell-nix, haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, runCommand, gitMinimal, buildPackages }:
22
33with lib;
44
@@ -34,7 +34,7 @@ let
3434 }) ++ [{
3535 packages.githash-test.components.exes.githash-test.build-tools = mkForce [ git ];
3636 }];
37− inherit compiler-nix-name;
37+ inherit compiler-nix-name evalPackages;
3838 };
3939
4040 packages = project.hsPkgs;
test/haskell-language-server/cabal.nix+2−2
@@ -1,6 +1,6 @@
1−{ stdenv, testSrc, evalPackages, haskell-nix, compiler-nix-name, recurseIntoAttrs }:
1+{ stdenv, testSrc, haskell-nix, compiler-nix-name, evalPackages, recurseIntoAttrs }:
22let
3− inherit (haskell-nix.tool compiler-nix-name "haskell-language-server" {}) project;
3+ inherit (haskell-nix.tool compiler-nix-name "haskell-language-server" { inherit evalPackages; }) project;
44in recurseIntoAttrs {
55 ifdInputs = {
66 inherit (project) plan-nix;
test/haskell-language-server/stack.nix+3−3
@@ -1,8 +1,8 @@
1−{ stdenv, lib, testSrc, haskell-nix, evalPackages, buildPackages, compiler-nix-name, recurseIntoAttrs }:
1+{ stdenv, lib, testSrc, haskell-nix, buildPackages, compiler-nix-name, evalPackages, recurseIntoAttrs }:
22let
33 project = buildPackages.haskell-nix.project' {
4− inherit compiler-nix-name;
5− src = evalPackages.fetchgit {
4+ inherit compiler-nix-name evalPackages;
5+ src = buildPackages.fetchgit {
66 url = "https://github.com/haskell/haskell-language-server.git";
77 fetchSubmodules = true;
88 rev = "32cd57df639d67ac0cf29882839e00532fd30c84";
test/index-state/default.nix+2−2
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, lib, testSrc, tool, compiler-nix-name }:
2+{ stdenv, lib, testSrc, tool, compiler-nix-name, evalPackages }:
33
44with lib;
55
@@ -8,7 +8,7 @@ let
88 # See https://hackage.haskell.org/package/hackage-security-0.6.0.1
99 version-used-at = index-state: ((tool compiler-nix-name "cabal" {
1010 version = "3.2.0.0";
11− inherit index-state;
11+ inherit index-state evalPackages;
1212 cabalProject = ''
1313 packages: .
1414 allow-newer: cabal-install:base, hackage-security:*
test/project-flags/cabal.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "project-flags";
99 };
1010 packages = project.hsPkgs;
test/project-flags/stack.nix+2−1
@@ -1,10 +1,11 @@
1−{ stdenv, lib, stackProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, stackProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = stackProject' {
77 src = testSrc "project-flags";
8+ inherit evalPackages;
89 };
910 packages = project.hsPkgs;
1011
test/setup-deps/default.nix+3−3
@@ -1,12 +1,12 @@
1−{ pkgs, compiler-nix-name }:
1+{ pkgs, compiler-nix-name, evalPackages }:
22
33with pkgs;
44with lib;
55
66let
77 project = haskell-nix.cabalProject' {
8− inherit compiler-nix-name;
9− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; };
8+ inherit compiler-nix-name evalPackages;
9+ src = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; };
1010 modules = [{
1111 # Package has no exposed modules which causes
1212 # haddock: No input file(s)
test/sha256map/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ pkgs, lib, stdenv, haskell-nix, testSrc, zlib, compiler-nix-name, recurseIntoAttrs } : recurseIntoAttrs {
1+{ pkgs, lib, stdenv, haskell-nix, testSrc, zlib, compiler-nix-name, evalPackages, recurseIntoAttrs } : recurseIntoAttrs {
22 # The version of pandoc used in this test does not build with ghcjs or ghc 8.10
33 meta.disabled = stdenv.hostPlatform.isGhcjs
44 || builtins.compareVersions pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "8.10" >= 0;
@@ -6,7 +6,7 @@
66 # A dependency is broken on windows, just run this on unix.
77 platforms = lib.platforms.unix;
88 } ((haskell-nix.hackage-package {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
1010 name = "pandoc";
1111 version = "2.9.2.1";
1212 # Function that returns a sha256 string by looking up the location
test/shell-for-setup-deps/default.nix+2−2
@@ -1,10 +1,10 @@
1−{ stdenv, lib, cabal-install, cabalProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabal-install, cabalProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
55let
66 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
88 src = testSrc "shell-for-setup-deps";
99 modules = [{
1010 # Package has no exposed modules which causes
test/shell-for/default.nix+2−1
@@ -1,4 +1,4 @@
1−{ stdenv, lib, cabal-install, mkCabalProjectPkgSet, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
1+{ stdenv, lib, cabal-install, mkCabalProjectPkgSet, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
@@ -13,6 +13,7 @@ let
1313 # Package has no exposed modules which causes
1414 # haddock: No input file(s)
1515 packages.bytestring-builder.doHaddock = false;
16+ inherit evalPackages;
1617 }];
1718 };
1819
test/snapshots/default.nix+1−1
@@ -1,4 +1,4 @@
1−{ stdenv, lib, haskellPackages, snapshots, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
1+{ stdenv, lib, haskellPackages, snapshots, recurseIntoAttrs, runCommand, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
test/stack-local-resolver-subdir/default.nix+2−1
@@ -1,8 +1,9 @@
1−{ project', recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ project', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33let
44 project = project' {
55 src = testSrc "stack-local-resolver-subdir";
6+ inherit evalPackages;
67 };
78 packages = project.hsPkgs;
89
test/stack-local-resolver/default.nix+2−1
@@ -1,8 +1,9 @@
1−{ project', recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ project', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33let
44 project = project' {
55 src = testSrc "stack-local-resolver";
6+ inherit evalPackages;
67 };
78 packages = project.hsPkgs;
89
test/stack-remote-resolver/default.nix+2−1
@@ -1,9 +1,10 @@
1−{ project', recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ project', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33let
44 project = project' {
55 src = testSrc "stack-remote-resolver";
66 resolverSha256 = "1rldkqqsxd8zxybrkqhc25bcxinhz212kz45jcz8jinfihc91jl7";
7+ inherit evalPackages;
78 };
89 packages = project.hsPkgs;
910
test/stack-simple/default.nix+2−2
@@ -1,4 +1,4 @@
1−{ stdenv, lib, pkgs, mkStackPkgSet, haskellLib, testSrc, compiler-nix-name }:
1+{ stdenv, lib, pkgs, mkStackPkgSet, haskellLib, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44
@@ -8,7 +8,7 @@ let
88 pkgSet = mkStackPkgSet {
99 stack-pkgs = import ./pkgs.nix;
1010 pkg-def-extras = [];
11− modules = [];
11+ modules = [{inherit evalPackages;}];
1212 };
1313
1414 packages = pkgSet.config.hsPkgs;
test/stack-source-repo/default.nix+2−1
@@ -1,8 +1,9 @@
1−{ stackProject', recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stackProject', recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33let
44 project = stackProject' {
55 src = testSrc "stack-source-repo";
6+ inherit evalPackages;
67 };
78 packages = project.hsPkgs;
89
test/sublib-docs/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test a package set
2−{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
66let
77 project = cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "sublib-docs";
1010 cabalProject = ''
1111 packages: .
test/th-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
11# Test building TH code that needs DLLs when cross compiling for windows
2−{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
2+{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
33
44with lib;
55
66let
77 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
99 src = testSrc "th-dlls";
1010 };
1111
test/unit.nix+4−4
@@ -1,4 +1,4 @@
1−{ pkgs, lib, haskellLib, compiler-nix-name }:
1+{ pkgs, evalPackages, lib, haskellLib, compiler-nix-name }:
22
33let
44 emptyConfig = {
@@ -119,9 +119,9 @@ lib.runTests {
119119 };
120120
121121 testParseRepositoryBlock = {
122− expr = __toJSON (haskellLib.parseRepositoryBlock "cabal.project" {} {}
123− pkgs.evalPackages.haskell-nix.cabal-install.${compiler-nix-name}
124− pkgs.evalPackages.haskell-nix.nix-tools.${compiler-nix-name} ''
122+ expr = __toJSON (haskellLib.parseRepositoryBlock evalPackages "cabal.project" {} {}
123+ evalPackages.haskell-nix.cabal-install.${compiler-nix-name}
124+ evalPackages.haskell-nix.nix-tools.${compiler-nix-name} ''
125125 ghcjs-overlay
126126 url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/bfc363b9f879c360e0a0460ec0c18ec87222ec32
127127 secure: True
test/with-packages/default.nix+3−1
@@ -1,4 +1,4 @@
1−{ stdenv, lib, util, mkPkgSet, recurseIntoAttrs, testSrc, compiler-nix-name }:
1+{ stdenv, lib, util, mkPkgSet, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages }:
22
33with lib;
44with util;
@@ -21,6 +21,8 @@ let
2121 {
2222 packages.test-with-packages.components.library.doExactConfig = doExactConfig;
2323 }
24+
25+ { inherit evalPackages; }
2426 ];
2527 };
2628