on iko/ghcjs-patch-master help sign in
Add `evalSystem` and `evalPackages` project args (#1546)
a443611Hamish Mackenzie
.buildkite/pipeline.yml+6
@@ -44,3 +44,9 @@ steps:
44 - nix build .#roots.x86_64-linux --option allow-import-from-derivation false
44 - nix build .#roots.x86_64-linux --option allow-import-from-derivation false
45 agents:
45 agents:
46 system: x86_64-linux
46 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
8{ nixpkgs ? haskellNix.sources.nixpkgs-2111
8{ nixpkgs ? haskellNix.sources.nixpkgs-2111
9, nixpkgsArgs ? haskellNix.nixpkgsArgs
9, nixpkgsArgs ? haskellNix.nixpkgsArgs
10, pkgs ? import nixpkgs nixpkgsArgs
10, pkgs ? import nixpkgs nixpkgsArgs
11+, evalPackages ? import nixpkgs nixpkgsArgs
11, nixpkgsForHydra ? haskellNix.sources.nixpkgs-2105
12, nixpkgsForHydra ? haskellNix.sources.nixpkgs-2105
12−, pkgsForHydra ? import nixpkgsForHydra nixpkgsArgs
13+, pkgsForHydra ? import nixpkgsForHydra (nixpkgsArgs // { inherit (pkgs) system; })
13, ifdLevel ? 1000
14, ifdLevel ? 1000
14, compiler-nix-name ? throw "No `compiler-nix-name` passed to build.nix"
15, compiler-nix-name ? throw "No `compiler-nix-name` passed to build.nix"
15}:
16}:
@@ -19,12 +20,13 @@ let
19 buildHaskell = pkgs.buildPackages.haskell-nix;
20 buildHaskell = pkgs.buildPackages.haskell-nix;
20 tool = buildHaskell.tool;
21 tool = buildHaskell.tool;
21in rec {
22in 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; };
23
24
24 tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
25 tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) (
25 pkgs.recurseIntoAttrs ({
26 pkgs.recurseIntoAttrs ({
26− cabal-latest = tool compiler-nix-name "cabal" "latest";
27+ cabal-latest = tool compiler-nix-name "cabal" { inherit evalPackages; };
27 hlint-latest = tool compiler-nix-name "hlint" {
28 hlint-latest = tool compiler-nix-name "hlint" {
29+ inherit evalPackages;
28 version = {
30 version = {
29 "ghc865" = "3.2.8";
31 "ghc865" = "3.2.8";
30 "ghc882" = "3.3.6";
32 "ghc882" = "3.3.6";
@@ -33,7 +35,7 @@ in rec {
33 }.compiler-nix-name or "latest";
35 }.compiler-nix-name or "latest";
34 };
36 };
35 } // pkgs.lib.optionalAttrs (!__elem compiler-nix-name ["ghc921" "ghc922" "ghc923"]) {
37 } // 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; };
37 })
39 })
38 );
40 );
39
41
@@ -85,7 +87,7 @@ in rec {
85 # These are pure parts of maintainer-script so they can be built by hydra
87 # These are pure parts of maintainer-script so they can be built by hydra
86 # and added to the cache to speed up buildkite.
88 # and added to the cache to speed up buildkite.
87 maintainer-script-cache = pkgs.recurseIntoAttrs (
89 maintainer-script-cache = pkgs.recurseIntoAttrs (
88− (pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
90+ (pkgs.lib.optionalAttrs (pkgsForHydra.system == "x86_64-linux") {
89 inherit (maintainer-scripts) check-hydra;
91 inherit (maintainer-scripts) check-hydra;
90 })
92 })
91 // (pkgs.lib.optionalAttrs (ifdLevel > 2) {
93 // (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 }:
2
2
3let
3let
4 # Builds a single component of a package.
4 # Builds a single component of a package.
@@ -46,6 +46,7 @@ let
46 hoogleLocal = let
46 hoogleLocal = let
47 nixpkgsHoogle = import (pkgs.path + /pkgs/development/haskell-modules/hoogle.nix);
47 nixpkgsHoogle = import (pkgs.path + /pkgs/development/haskell-modules/hoogle.nix);
48 in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc8107" "hoogle" {
48 in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "ghc8107" "hoogle" {
49+ inherit evalPackages;
49 version = "5.0.18.3";
50 version = "5.0.18.3";
50 index-state = pkgs.haskell-nix.internalHackageIndexState;
51 index-state = pkgs.haskell-nix.internalHackageIndexState;
51 }
52 }
@@ -66,7 +67,7 @@ let
66
67
67 # Same as haskellPackages.shellFor in nixpkgs.
68 # Same as haskellPackages.shellFor in nixpkgs.
68 shellFor = haskellLib.weakCallPackage pkgs ./shell-for.nix {
69 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;
70 inherit (buildPackages) glibcLocales;
71 inherit (buildPackages) glibcLocales;
71 };
72 };
72
73
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 }:
2
2
3{ # `packages` function selects packages that will be worked on in the shell itself.
3{ # `packages` function selects packages that will be worked on in the shell itself.
4 # These packages will not be built by `shellFor`, but their
4 # These packages will not be built by `shellFor`, but their
@@ -133,7 +133,12 @@ let
133 # inherit (hsPkgs) hoogle;
133 # inherit (hsPkgs) hoogle;
134 } // (
134 } // (
135 lib.optionalAttrs (args ? tools && args.tools ? hoogle) {
135 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+ }]);
137 }
142 }
138 ));
143 ));
139
144
@@ -147,7 +152,7 @@ in
147 nativeBuildInputs = [ ghcEnv ]
152 nativeBuildInputs = [ ghcEnv ]
148 ++ nativeBuildInputs
153 ++ nativeBuildInputs
149 ++ mkDrvArgs.nativeBuildInputs or []
154 ++ 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)
151 # If this shell is a cross compilation shell include
156 # If this shell is a cross compilation shell include
152 # wrapper script for running cabal build with appropriate args.
157 # wrapper script for running cabal build with appropriate args.
153 # Includes `--with-compiler` in case the `cabal.project` file has `with-compiler:` in it.
158 # Includes `--with-compiler` in case the `cabal.project` file has `with-compiler:` in it.
changelog.md+26
@@ -1,6 +1,32 @@
1This file contains a summary of changes to Haskell.nix and `nix-tools`
1This file contains a summary of changes to Haskell.nix and `nix-tools`
2that will impact users.
2that will impact users.
3
3
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+
4## Feb 16, 2022
30## Feb 16, 2022
5* Removed lookupSha256 argument from project functions.
31* Removed lookupSha256 argument from project functions.
6 Pass a `sha256map` instead.
32 Pass a `sha256map` instead.
ci.nix+7−8
@@ -78,12 +78,11 @@
78in
78in
79dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
79dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
80 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
80 let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
81− # We need this for generic nixpkgs stuff at the right version
82− genericPkgs = import pinnedNixpkgsSrc {};
81+ evalPackages = import pinnedNixpkgsSrc nixpkgsArgs;
83− in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: {runTests}:
82+ in dimension "GHC version" (compilerNixNames nixpkgsName evalPackages) (compiler-nix-name: {runTests}:
84− dimension "System" (systems nixpkgsName genericPkgs compiler-nix-name) (systemName: system:
83+ dimension "System" (systems nixpkgsName evalPackages compiler-nix-name) (systemName: system:
85 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
84 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; };
87 platformFilter = platformFilterGeneric pkgs system;
86 platformFilter = platformFilterGeneric pkgs system;
88 in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
87 in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
89 # Native builds
88 # Native builds
@@ -96,14 +95,14 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
96 } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
95 } // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
97 iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
96 iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
98 } // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
97 } // 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";
100 });
99 });
101 }
100 }
102 //
101 //
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:
104 # Cross builds
103 # Cross builds
105 let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
104 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; };
107 in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
106 in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
108 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
107 roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
109 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
108 ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
flake.nix+7−1
@@ -59,7 +59,7 @@
59 };
59 };
60 };
60 };
61
61
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:
63 let compiler = "ghc923";
63 let compiler = "ghc923";
64 config = import ./config.nix;
64 config = import ./config.nix;
65 in {
65 in {
@@ -101,6 +101,12 @@
101 };
101 };
102 pkgs = import nixpkgs
102 pkgs = import nixpkgs
103 (nixpkgsArgs // { localSystem = { inherit system; }; });
103 (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; }; });
104 pkgs-unstable = import nixpkgs-unstable
110 pkgs-unstable = import nixpkgs-unstable
105 (nixpkgsArgs // { localSystem = { inherit system; }; });
111 (nixpkgsArgs // { localSystem = { inherit system; }; });
106 hix = import ./hix/default.nix { inherit pkgs; };
112 hix = import ./hix/default.nix { inherit pkgs; };
hix/project.nix+5−5
@@ -56,20 +56,20 @@ let
56 nixpkgsArgs = config.haskellNix.nixpkgsArgs // {
56 nixpkgsArgs = config.haskellNix.nixpkgsArgs // {
57 overlays = config.haskellNix.nixpkgsArgs.overlays ++ config.overlays;
57 overlays = config.haskellNix.nixpkgsArgs.overlays ++ config.overlays;
58 };
58 };
59− pkgs = import config.nixpkgs config.nixpkgsArgs;
59+ _module.args.pkgs = import config.nixpkgs config.nixpkgsArgs;
60− project = config.pkgs.haskell-nix.project [
60+ project = pkgs.haskell-nix.project [
61 (import ../modules/hix-project.nix)
61 (import ../modules/hix-project.nix)
62 userDefaults
62 userDefaults
63 projectDefaults
63 projectDefaults
64 commandArgs'
64 commandArgs'
65− {
65+ ({config, ...}: {
66 src =
66 src =
67 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
67 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
68− then config.pkgs.haskell-nix.haskellLib.cleanGit {
68+ then config.evalPackages.haskell-nix.haskellLib.cleanGit {
69 inherit src name;
69 inherit src name;
70 }
70 }
71 else src;
71 else src;
72− }
72+ })
73 ];
73 ];
74 })
74 })
75 ];
75 ];
lib/cabal-project-parser.nix+11−11
@@ -122,7 +122,7 @@ let
122 # This works because `cabal configure` does not include any of the `/nix/sore/`
122 # This works because `cabal configure` does not include any of the `/nix/sore/`
123 # paths in the `plan.json` (so materialized plan-nix will still work as expeced).
123 # paths in the `plan.json` (so materialized plan-nix will still work as expeced).
124 # See tests/unit.nix for examples of input and output.
124 # 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:
126 let
126 let
127 lines = pkgs.lib.splitString "\n" block;
127 lines = pkgs.lib.splitString "\n" block;
128 # The first line will contain the repository name.
128 # The first line will contain the repository name.
@@ -138,7 +138,7 @@ let
138 # The $HOME/.cabal/packages/${name} after running `cabal v2-update` to download the repository
138 # The $HOME/.cabal/packages/${name} after running `cabal v2-update` to download the repository
139 repoContents = if inputMap ? ${attrs.url}
139 repoContents = if inputMap ? ${attrs.url}
140 # If there is an input use it to make `file:` url and create a suitable `.cabal/packages/${name}` directory
140 # 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 ({
142 nativeBuildInputs = [ cabal-install ];
142 nativeBuildInputs = [ cabal-install ];
143 preferLocalBuild = true;
143 preferLocalBuild = true;
144 }) ''
144 }) ''
@@ -155,9 +155,9 @@ let
155 cabal v2-update ${name}
155 cabal v2-update ${name}
156 cp -r $HOME/.cabal/packages/${name} $out
156 cp -r $HOME/.cabal/packages/${name} $out
157 ''
157 ''
158− else pkgs.evalPackages.runCommand name ({
158+ else evalPackages.runCommand name ({
159− nativeBuildInputs = [ cabal-install pkgs.evalPackages.curl nix-tools ];
159+ nativeBuildInputs = [ cabal-install evalPackages.curl nix-tools ];
160− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.evalPackages.stdenv.buildPlatform.libc == "glibc") "${pkgs.evalPackages.glibcLocales}/lib/locale/locale-archive";
160+ LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
161 LANG = "en_US.UTF-8";
161 LANG = "en_US.UTF-8";
162 preferLocalBuild = true;
162 preferLocalBuild = true;
163 } // pkgs.lib.optionalAttrs (sha256 != null) {
163 } // pkgs.lib.optionalAttrs (sha256 != null) {
@@ -175,15 +175,15 @@ let
175 ${pkgs.lib.optionalString (attrs ? key-threshold) "key-threshold: ${attrs.key-threshold}"}
175 ${pkgs.lib.optionalString (attrs ? key-threshold) "key-threshold: ${attrs.key-threshold}"}
176 EOF
176 EOF
177
177
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
179 cabal v2-update ${name}
179 cabal v2-update ${name}
180 cp -r $HOME/.cabal/packages/${name} $out
180 cp -r $HOME/.cabal/packages/${name} $out
181 '';
181 '';
182 # Output of hackage-to-nix
182 # Output of hackage-to-nix
183 hackage = import (
183 hackage = import (
184− pkgs.evalPackages.runCommand ("hackage-to-nix-" + name) {
184+ evalPackages.runCommand ("hackage-to-nix-" + name) {
185− nativeBuildInputs = [ cabal-install pkgs.evalPackages.curl nix-tools ];
185+ nativeBuildInputs = [ cabal-install evalPackages.curl nix-tools ];
186− LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.evalPackages.stdenv.buildPlatform.libc == "glibc") "${pkgs.evalPackages.glibcLocales}/lib/locale/locale-archive";
186+ LOCALE_ARCHIVE = pkgs.lib.optionalString (evalPackages.stdenv.buildPlatform.libc == "glibc") "${evalPackages.glibcLocales}/lib/locale/locale-archive";
187 LANG = "en_US.UTF-8";
187 LANG = "en_US.UTF-8";
188 preferLocalBuild = true;
188 preferLocalBuild = true;
189 } ''
189 } ''
@@ -196,11 +196,11 @@ let
196 };
196 };
197 };
197 };
198
198
199− parseRepositories = cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: projectFile:
199+ parseRepositories = evalPackages: cabalProjectFileName: sha256map: inputMap: cabal-install: nix-tools: projectFile:
200 let
200 let
201 # This will leave the name of repository in the first line of each block
201 # This will leave the name of repository in the first line of each block
202 blocks = pkgs.lib.splitString "\nrepository " ("\n" + projectFile);
202 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);
204 in {
204 in {
205 extra-hackages = pkgs.lib.lists.map (block: block.hackage) repoBlocks;
205 extra-hackages = pkgs.lib.lists.map (block: block.hackage) repoBlocks;
206 repos = pkgs.lib.lists.foldl' (x: block: x // block.repo) {} repoBlocks;
206 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:
2let readIfExists = src: fileName:
2let readIfExists = src: fileName:
3 let origSrcDir = src.origSrcSubDir or src;
3 let origSrcDir = src.origSrcSubDir or src;
4 in
4 in
@@ -64,10 +64,13 @@ in
64 # would result in the "foo" subdirectory of
64 # would result in the "foo" subdirectory of
65 # any plutus-apps input being used for a
65 # any plutus-apps input being used for a
66 # package.
66 # package.
67+, evalPackages
67, ...
68, ...
68}@args:
69}@args:
69
70
70let
71let
72+ inherit (evalPackages.haskell-nix) materialize dotCabal;
73+
71 # These defaults are hear rather than in modules/cabal-project.nix to make them
74 # These defaults are hear rather than in modules/cabal-project.nix to make them
72 # lazy enough to avoid infinite recursion issues.
75 # lazy enough to avoid infinite recursion issues.
73 # Using null as the default also improves performance as they are not forced by the
76 # Using null as the default also improves performance as they are not forced by the
@@ -219,8 +222,8 @@ let
219 in {
222 in {
220 # Download the source-repository-package commit and add it to a minimal git
223 # Download the source-repository-package commit and add it to a minimal git
221 # repository that `cabal` will be able to access from a non fixed output derivation.
224 # repository that `cabal` will be able to access from a non fixed output derivation.
222− location = pkgs.evalPackages.runCommand "source-repository-package" {
225+ location = evalPackages.runCommand "source-repository-package" {
223− nativeBuildInputs = [ pkgs.evalPackages.rsync pkgs.evalPackages.gitMinimal ];
226+ nativeBuildInputs = [ evalPackages.rsync evalPackages.gitMinimal ];
224 } ''
227 } ''
225 mkdir $out
228 mkdir $out
226 rsync -a --prune-empty-dirs "${fetched}/" "$out/"
229 rsync -a --prune-empty-dirs "${fetched}/" "$out/"
@@ -241,24 +244,24 @@ let
241
244
242 # Parse the `repository` blocks
245 # Parse the `repository` blocks
243 repoResult = pkgs.haskell-nix.haskellLib.parseRepositories
246 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;
245
248
246 # we need the repository content twice:
249 # we need the repository content twice:
247 # * at eval time (below to build the fixed project file)
250 # * 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
249 # the build plan for any target without a remote builder
252 # the build plan for any target without a remote builder
250 # * at built time (passed out)
253 # * at built time (passed out)
251 # Here we want to use plain pkgs.fetchgit, which is what a builder
254 # Here we want to use plain pkgs.fetchgit, which is what a builder
252 # on the target system would use, so that the derivation is unaffected
255 # on the target system would use, so that the derivation is unaffected
253 # and, say, a linux release build job can identify the derivation
256 # and, say, a linux release build job can identify the derivation
254 # as built by a darwin builder, and fetch it from a cache
257 # 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;
256 sourceReposBuild = builtins.map (x: (fetchPackageRepo pkgs.fetchgit x).fetched) sourceRepoPackageResult.sourceRepos;
259 sourceReposBuild = builtins.map (x: (fetchPackageRepo pkgs.fetchgit x).fetched) sourceRepoPackageResult.sourceRepos;
257 in {
260 in {
258 sourceRepos = sourceReposBuild;
261 sourceRepos = sourceReposBuild;
259 inherit (repoResult) repos extra-hackages;
262 inherit (repoResult) repos extra-hackages;
260 makeFixedProjectFile = ''
263 makeFixedProjectFile = ''
261− cp -f ${pkgs.evalPackages.writeText "cabal.project" sourceRepoPackageResult.otherText} ./cabal.project
264+ cp -f ${evalPackages.writeText "cabal.project" sourceRepoPackageResult.otherText} ./cabal.project
262 '' +
265 '' +
263 pkgs.lib.optionalString (builtins.length sourceReposEval != 0) (''
266 pkgs.lib.optionalString (builtins.length sourceReposEval != 0) (''
264 chmod +w -R ./cabal.project
267 chmod +w -R ./cabal.project
@@ -365,12 +368,12 @@ let
365 '');
368 '');
366
369
367 # Dummy `ghc` that uses the captured output
370 # Dummy `ghc` that uses the captured output
368− dummy-ghc = pkgs.evalPackages.writeTextFile {
371+ dummy-ghc = evalPackages.writeTextFile {
369 name = "dummy-" + ghc.name;
372 name = "dummy-" + ghc.name;
370 executable = true;
373 executable = true;
371 destination = "/bin/${ghc.targetPrefix}ghc";
374 destination = "/bin/${ghc.targetPrefix}ghc";
372 text = ''
375 text = ''
373− #!${pkgs.evalPackages.runtimeShell}
376+ #!${evalPackages.runtimeShell}
374 case "$*" in
377 case "$*" in
375 --version*)
378 --version*)
376 cat ${dummy-ghc-data}/ghc/version
379 cat ${dummy-ghc-data}/ghc/version
@@ -408,12 +411,12 @@ let
408 };
411 };
409
412
410 # Dummy `ghc-pkg` that uses the captured output
413 # Dummy `ghc-pkg` that uses the captured output
411− dummy-ghc-pkg = pkgs.evalPackages.writeTextFile {
414+ dummy-ghc-pkg = evalPackages.writeTextFile {
412 name = "dummy-pkg-" + ghc.name;
415 name = "dummy-pkg-" + ghc.name;
413 executable = true;
416 executable = true;
414 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
417 destination = "/bin/${ghc.targetPrefix}ghc-pkg";
415 text = ''
418 text = ''
416− #!${pkgs.evalPackages.runtimeShell}
419+ #!${evalPackages.runtimeShell}
417 case "$*" in
420 case "$*" in
418 --version)
421 --version)
419 cat ${dummy-ghc-data}/ghc-pkg/version
422 cat ${dummy-ghc-data}/ghc-pkg/version
@@ -449,10 +452,10 @@ let
449 else null;
452 else null;
450 } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
453 } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
451 inherit checkMaterialization;
454 inherit checkMaterialization;
452− }) (pkgs.evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
455+ }) (evalPackages.runCommand (nameAndSuffix "plan-to-nix-pkgs") {
453− nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install pkgs.evalPackages.rsync pkgs.evalPackages.gitMinimal ];
456+ nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install evalPackages.rsync evalPackages.gitMinimal ];
454 # Needed or stack-to-nix will die on unicode inputs
457 # 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";
456 LANG = "en_US.UTF-8";
459 LANG = "en_US.UTF-8";
457 meta.platforms = pkgs.lib.platforms.all;
460 meta.platforms = pkgs.lib.platforms.all;
458 preferLocalBuild = false;
461 preferLocalBuild = false;
@@ -474,11 +477,11 @@ let
474 '';
477 '';
475 in {
478 in {
476 # These check for cabal configure failure
479 # These check for cabal configure failure
477− json = pkgs.evalPackages.runCommand (nameAndSuffix "plan-json") {} ''
480+ json = evalPackages.runCommand (nameAndSuffix "plan-json") {} ''
478 ${checkCabalConfigure}
481 ${checkCabalConfigure}
479 cp ${plan-nix.maybeJson} $out
482 cp ${plan-nix.maybeJson} $out
480 '';
483 '';
481− freeze = pkgs.evalPackages.runCommand (nameAndSuffix "plan-freeze") {} ''
484+ freeze = evalPackages.runCommand (nameAndSuffix "plan-freeze") {} ''
482 ${checkCabalConfigure}
485 ${checkCabalConfigure}
483 cp ${plan-nix.maybeFreeze} $out
486 cp ${plan-nix.maybeFreeze} $out
484 '';
487 '';
@@ -520,7 +523,7 @@ let
520 ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
523 ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
521 ${fixedProject.makeFixedProjectFile}
524 ${fixedProject.makeFixedProjectFile}
522 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
525 ${pkgs.lib.optionalString (cabalProjectFreeze != null) ''
523− cp ${pkgs.evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
526+ cp ${evalPackages.writeText "cabal.project.freeze" cabalProjectFreeze} \
524 cabal.project.freeze
527 cabal.project.freeze
525 chmod +w cabal.project.freeze
528 chmod +w cabal.project.freeze
526 ''}
529 ''}
lib/call-stack-to-nix.nix+13−11
@@ -5,7 +5,6 @@
5 *
5 *
6 * see also `call-cabal-project-to-nix`!
6 * see also `call-cabal-project-to-nix`!
7 */
7 */
8−{ runCommand, pkgs, mkCacheFile, materialize, haskellLib }:
9{ name ? src.name or null # optional name for better error messages
8{ name ? src.name or null # optional name for better error messages
10, src
9, src
11, stackYaml ? "stack.yaml"
10, stackYaml ? "stack.yaml"
@@ -15,21 +14,24 @@
15, resolverSha256 ? null
14, resolverSha256 ? null
16, materialized ? null # Location of a materialized copy of the nix files
15, materialized ? null # Location of a materialized copy of the nix files
17, checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material
16, 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)
17+, nix-tools
18+, evalPackages
19−, ... }:
19+, ... }@args:
20let
20let
21+ inherit (evalPackages) runCommand;
22+ inherit (evalPackages.haskell-nix) mkCacheFile materialize haskellLib;
21 inherit (haskellLib.fetchResolver {
23 inherit (haskellLib.fetchResolver {
22 inherit src stackYaml resolverSha256;
24 inherit src stackYaml resolverSha256;
23 }) resolver fetchedResolver;
25 }) resolver fetchedResolver;
24
26
25 subDir' = src.origSubDir or "";
27 subDir' = src.origSubDir or "";
26− subDir = pkgs.lib.strings.removePrefix "/" subDir';
28+ subDir = evalPackages.lib.strings.removePrefix "/" subDir';
27 cleanedSource = (haskellLib.cleanSourceWith {
29 cleanedSource = (haskellLib.cleanSourceWith {
28 name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files";
30 name = if name != null then "${name}-root-cabal-files" else "source-root-cabal-files";
29 src = src.origSrc or src;
31 src = src.origSrc or src;
30 filter = path: type: (!(src ? filter) || src.filter path type) && (
32 filter = path: type: (!(src ? filter) || src.filter path type) && (
31 type == "directory" ||
33 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" ]); });
33
35
34 stackToNixArgs = builtins.concatStringsSep " " [
36 stackToNixArgs = builtins.concatStringsSep " " [
35 "--full"
37 "--full"
@@ -43,12 +45,12 @@ let
43 sha256Arg = "stack-sha256";
45 sha256Arg = "stack-sha256";
44 reasonNotSafe = null;
46 reasonNotSafe = null;
45 this = "project.stack-nix" + (if name != null then " for ${name}" else "");
47 this = "project.stack-nix" + (if name != null then " for ${name}" else "");
46− } // pkgs.lib.optionalAttrs (checkMaterialization != null) {
48+ } // evalPackages.lib.optionalAttrs (checkMaterialization != null) {
47 inherit checkMaterialization;
49 inherit checkMaterialization;
48 }) (runCommand (if name == null then "stack-to-nix-pkgs" else name + "-stack-to-nix-pkgs") {
50 }) (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 ];
50 # Needed or stack-to-nix will die on unicode inputs
52 # 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";
52 LANG = "en_US.UTF-8";
54 LANG = "en_US.UTF-8";
53 LC_ALL = "en_US.UTF-8";
55 LC_ALL = "en_US.UTF-8";
54 preferLocalBuild = false;
56 preferLocalBuild = false;
@@ -64,10 +66,10 @@ let
64 echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
66 echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
65 fi
67 fi
66 lndir -silent "${cleanedSource}/." $SRC
68 lndir -silent "${cleanedSource}/." $SRC
67− ${pkgs.lib.optionalString (subDir != "") "cd ${subDir}"}
69+ ${evalPackages.lib.optionalString (subDir != "") "cd ${subDir}"}
68 ${
70 ${
69 # If a resolver was fetched use the it instead of the original stack.yaml
71 # 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)
71 # Replace the resolver path in the stack.yaml with the fetched version
73 # Replace the resolver path in the stack.yaml with the fetched version
72 ''
74 ''
73 rm ${stackYaml}
75 rm ${stackYaml}
@@ -75,7 +77,7 @@ let
75 chmod +w ${stackYaml}
77 chmod +w ${stackYaml}
76 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
78 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
77 ''}
79 ''}
78− ${pkgs.lib.optionalString (cache != null) ''
80+ ${evalPackages.lib.optionalString (cache != null) ''
79 cp ${mkCacheFile cache}/.stack-to-nix.cache* $out${subDir'}
81 cp ${mkCacheFile cache}/.stack-to-nix.cache* $out${subDir'}
80 ''}
82 ''}
81 (cd $out${subDir'} && stack-to-nix ${stackToNixArgs})
83 (cd $out${subDir'} && stack-to-nix ${stackToNixArgs})
lib/default.nix+13−14
@@ -4,11 +4,8 @@
4with haskellLib;
4with haskellLib;
5
5
6let
6let
7− # Why `final.evalPackages.buildPackages.gitMinimal`?
7+ # Why `final.buildPackages.buildPackages.gitMinimal`?
8− # Why not just final.evalPackages.gitMinimal?
8+ # Why not just final.buildPackages.gitMinimal?
9− #
10− # A problem arises when `evalPackages` is `buildPackages`.i
11− # As may be the case in a flake.
12 #
9 #
13 # It turns out `git` depends on `gdb` in a round about way:
10 # It turns out `git` depends on `gdb` in a round about way:
14 # git -> openssh -> libfido2 -> systemd -> python libxml -> Cython -> gdb
11 # git -> openssh -> libfido2 -> systemd -> python libxml -> Cython -> gdb
@@ -24,7 +21,7 @@ let
24 # * When `gdb` does not exist for `js`, so when cross
21 # * When `gdb` does not exist for `js`, so when cross
25 # compiling with ghcjs `final.buildPackages.git` fails
22 # compiling with ghcjs `final.buildPackages.git` fails
26 # to build at all.
23 # to build at all.
27− inherit (pkgs.evalPackages.buildPackages) gitMinimal;
24+ inherit (pkgs.buildPackages.buildPackages) gitMinimal;
28
25
29in {
26in {
30 # Within the package components, these are the attribute names of
27 # Within the package components, these are the attribute names of
@@ -202,7 +199,7 @@ in {
202 cleanGit = import ./clean-git.nix {
199 cleanGit = import ./clean-git.nix {
203 inherit lib cleanSourceWith;
200 inherit lib cleanSourceWith;
204 git = gitMinimal;
201 git = gitMinimal;
205− inherit (pkgs.evalPackages.buildPackages) runCommand;
202+ inherit (pkgs.buildPackages.buildPackages) runCommand;
206 };
203 };
207
204
208 # Some times it is handy to temporarily use a relative path between git
205 # Some times it is handy to temporarily use a relative path between git
@@ -260,17 +257,19 @@ in {
260 && stdenv.buildPlatform == stdenv.hostPlatform
257 && stdenv.buildPlatform == stdenv.hostPlatform
261 && stdenv.hostPlatform == stdenv.targetPlatform;
258 && stdenv.hostPlatform == stdenv.targetPlatform;
262
259
263− # Takes a version number or attr set of arguments (for cabalProject)
260+ # Takes a version number, module or list of modules (for cabalProject)
264− # and converts it to an attr set of arguments. This allows
261+ # and converts it to an list of project modules. This allows
265 # the use of "1.0.0.0" or { version = "1.0.0.0"; ... }
262 # the use of "1.0.0.0" or { version = "1.0.0.0"; ... }
266− versionOrArgsToArgs = versionOrArgs:
263+ versionOrModToMods = versionOrMod:
267− if lib.isAttrs versionOrArgs
264+ if lib.isString versionOrMod
268− then versionOrArgs
265+ then [{ version = versionOrMod; }]
269− else { version = versionOrArgs; };
266+ else if lib.isList versionOrMod
267+ then versionOrMod
268+ else [versionOrMod];
270
269
271 # Find the resolver in the stack.yaml file and fetch it if a sha256 value is provided
270 # Find the resolver in the stack.yaml file and fetch it if a sha256 value is provided
272 fetchResolver = import ./fetch-resolver.nix {
271 fetchResolver = import ./fetch-resolver.nix {
273− inherit (pkgs.evalPackages) pkgs;
272+ inherit (pkgs.buildPackages) pkgs;
274 };
273 };
275
274
276 inherit (import ./cabal-project-parser.nix {
275 inherit (import ./cabal-project-parser.nix {
lib/ghcjs-project.nix−1
@@ -50,7 +50,6 @@
50 cabalProjectLocal = ''
50 cabalProjectLocal = ''
51 constraints: Cabal <3.2.1.0
51 constraints: Cabal <3.2.1.0
52 '';
52 '';
53− modules = [{ reinstallableLibGhc = true; }];
54 materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
53 materialized = ../materialized/ghcjs/cabal + "/${compiler-nix-name}";
55 }
54 }
56, ...
55, ...
lib/spdx/licenses.nix+3−3
@@ -1,13 +1,13 @@
1pkgs:
1pkgs:
2with builtins; let
2with 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;
4 materialized' = ../../materialized + "/spdx-${spdxJson.version}";
4 materialized' = ../../materialized + "/spdx-${spdxJson.version}";
5 licensesJSON = fromJSON (replaceStrings
5 licensesJSON = fromJSON (replaceStrings
6 [ "\\u0026" "\\u0027" "\\u003d" ]
6 [ "\\u0026" "\\u0027" "\\u003d" ]
7 [ "&" "'" "=" ]
7 [ "&" "'" "=" ]
8− (readFile "${pkgs.evalPackages.haskell-nix.materialize {
8+ (readFile "${pkgs.buildPackages.haskell-nix.materialize {
9 materialized = if pathExists materialized' then materialized' else null;
9 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; } ''
11 mkdir $out
11 mkdir $out
12 cp ${spdxJson}/json/licenses.json $out
12 cp ${spdxJson}/json/licenses.json $out
13 '')
13 '')
lib/stack-cache-generator.nix+17−14
@@ -1,6 +1,5 @@
1# Generate cache entries for dependencies of package defined in `src`
1# Generate cache entries for dependencies of package defined in `src`
2
2
3−{ pkgs, haskellLib }:
4{ src
3{ src
5, stackYaml ? "stack.yaml"
4, stackYaml ? "stack.yaml"
6, sha256map ? null
5, sha256map ? null
@@ -17,10 +16,14 @@
17 then { location, tag, ...}: branchMap."${location}"."${tag}" or null
16 then { location, tag, ...}: branchMap."${location}"."${tag}" or null
18 else _: null
17 else _: null
19, resolverSha256 ? null
18, 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
21, ...
21, ...
22−}:
22+}@args:
23let
23let
24+ inherit (evalPackages) runCommand;
25+ inherit (evalPackages.haskell-nix) haskellLib;
26+
24 # We only care about the stackYaml file. If src is a local directory
27 # We only care about the stackYaml file. If src is a local directory
25 # we want to avoid recalculating the cache unless the stack.yaml file
28 # we want to avoid recalculating the cache unless the stack.yaml file
26 # changes.
29 # changes.
@@ -36,10 +39,10 @@ let
36 let
39 let
37 origSrc = if src ? _isLibCleanSourceWith then src.origSrc else src;
40 origSrc = if src ? _isLibCleanSourceWith then src.origSrc else src;
38 origSubDir = if src ? _isLibCleanSourceWithEx then src.origSubDir else "";
41 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;
40
43
41 # checks if path1 is a parent directory for path2
44 # 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;
43
46
44 in
47 in
45 (relPath == stackYaml)
48 (relPath == stackYaml)
@@ -48,9 +51,9 @@ let
48 };
51 };
49
52
50 # All repos served via ssh or git protocols are usually private
53 # 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";
52
55
53− repos = builtins.fromJSON (builtins.readFile (pkgs.runCommand "stack-repos" {
56+ repos = builtins.fromJSON (builtins.readFile (evalPackages.runCommand "stack-repos" {
54 buildInputs = [ nix-tools ];
57 buildInputs = [ nix-tools ];
55 } ''
58 } ''
56 TMP=$(mktemp -d)
59 TMP=$(mktemp -d)
@@ -58,23 +61,23 @@ let
58 cp -r "${maybeCleanedSource}/." $TMP
61 cp -r "${maybeCleanedSource}/." $TMP
59 chmod -R +w $TMP
62 chmod -R +w $TMP
60 substituteInPlace ${stackYaml} --replace "# nix-sha256:" "nix-sha256:"
63 substituteInPlace ${stackYaml} --replace "# nix-sha256:" "nix-sha256:"
61− ${pkgs.lib.optionalString (fetchedResolver != null) ''
64+ ${evalPackages.lib.optionalString (fetchedResolver != null) ''
62 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
65 substituteInPlace ${stackYaml} --replace "${resolver}" "${fetchedResolver}"
63 ''}
66 ''}
64 stack-repos --stack-yaml ${stackYaml}
67 stack-repos --stack-yaml ${stackYaml}
65 cp repos.json $out
68 cp repos.json $out
66 ''));
69 ''));
67
70
68− cabalName = path: builtins.readFile (pkgs.runCommand "cabal-name" {
71+ cabalName = path: builtins.readFile (evalPackages.runCommand "cabal-name" {
69 buildInputs = [ nix-tools ];
72 buildInputs = [ nix-tools ];
70 } ''
73 } ''
71 cabal-name ${path} > $out
74 cabal-name ${path} > $out
72 '');
75 '');
73
76
74 hashPath = path:
77 hashPath = path:
75− builtins.readFile (pkgs.runCommand "hash-path" { preferLocalBuild = true; }
78+ builtins.readFile (evalPackages.runCommand "hash-path" { preferLocalBuild = true; }
76− "echo -n $(${pkgs.nix}/bin/nix-hash --type sha256 --base32 ${path}) > $out");
79+ "echo -n $(${evalPackages.nix}/bin/nix-hash --type sha256 --base32 ${path}) > $out");
77−in with pkgs.lib;
80+in with evalPackages.lib;
78concatMap (dep:
81concatMap (dep:
79 let
82 let
80 is-private = private dep.url;
83 is-private = private dep.url;
@@ -88,13 +91,13 @@ concatMap (dep:
88 };
91 };
89 pkgsrc =
92 pkgsrc =
90 if !is-private && sha256 != null
93 if !is-private && sha256 != null
91− then pkgs.fetchgit {
94+ then evalPackages.fetchgit {
92 inherit (dep) url rev;
95 inherit (dep) url rev;
93 inherit sha256;
96 inherit sha256;
94 }
97 }
95 else builtins.fetchGit ({
98 else builtins.fetchGit ({
96 inherit (dep) url rev;
99 inherit (dep) url rev;
97− } // pkgs.lib.optionalAttrs (branch != null) { ref = branch; });
100+ } // evalPackages.lib.optionalAttrs (branch != null) { ref = branch; });
98 in map (subdir: {
101 in map (subdir: {
99 name = cabalName "${pkgsrc}/${subdir}";
102 name = cabalName "${pkgsrc}/${subdir}";
100 inherit (dep) url rev;
103 inherit (dep) url rev;
lib/system-nixpkgs-map.nix+1−1
@@ -11,7 +11,7 @@ let
11 gcclibs = if pkgs.stdenv.hostPlatform.isWindows then [
11 gcclibs = if pkgs.stdenv.hostPlatform.isWindows then [
12 pkgs.windows.mcfgthreads
12 pkgs.windows.mcfgthreads
13 # If we just use `pkgs.buildPackages.gcc.cc` here it breaks the `th-dlls` test. TODO figure out why exactly.
13 # 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 ]; } ''
15 mkdir $out
15 mkdir $out
16 lndir ${pkgs.buildPackages.gcc.cc} $out
16 lndir ${pkgs.buildPackages.gcc.cc} $out
17 '')
17 '')
lib/system-pkgs.nix−5
@@ -12,10 +12,5 @@ pkgs:
12 # Base packages.
12 # Base packages.
13 pkgs
13 pkgs
14
14
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−
20 # Apply the mapping.
15 # Apply the mapping.
21 // import ./system-nixpkgs-map.nix pkgs
16 // import ./system-nixpkgs-map.nix pkgs
mk-local-hackage-repo/default.nix+1−1
@@ -17,7 +17,7 @@
17pkgs:
17pkgs:
18{ name, index }:
18{ name, index }:
19
19
20−pkgs.evalPackages.runCommand "hackage-repo-${name}" { preferLocalBuild = true; } ''
20+pkgs.buildPackages.runCommand "hackage-repo-${name}" { preferLocalBuild = true; } ''
21mkdir -p $out
21mkdir -p $out
22export expires="4000-01-01T00:00:00Z"
22export expires="4000-01-01T00:00:00Z"
23
23
modules/cabal-project.nix−5
@@ -56,11 +56,6 @@ in {
56 type = nullOr str;
56 type = nullOr str;
57 default = readIfExists config.src "${config.cabalProjectFileName}.freeze";
57 default = readIfExists config.src "${config.cabalProjectFileName}.freeze";
58 };
58 };
59− caller = mkOption {
60− type = str;
61− default = "callCabalProjectToNix";
62− description = "Name of the calling function for better warning messages";
63− };
64 ghc = mkOption {
59 ghc = mkOption {
65 type = nullOr package;
60 type = nullOr package;
66 default = null;
61 default = null;
modules/component-driver.nix+1−1
@@ -4,7 +4,7 @@ let
4 inherit haskellLib;
4 inherit haskellLib;
5 ghc = config.ghc.package;
5 ghc = config.ghc.package;
6 compiler-nix-name = config.compiler.nix-name;
6 compiler-nix-name = config.compiler.nix-name;
7− inherit (config) nonReinstallablePkgs hsPkgs compiler;
7+ inherit (config) nonReinstallablePkgs hsPkgs compiler evalPackages;
8 };
8 };
9
9
10in
10in
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
3# that use it (like `hackage-package`)
2# that use it (like `hackage-package`)
4#
3#
5−final: prev:
6let
4let
7− inherit (final) lib;
5+ # Easier than importing nixpkgs just for this
8−
6+ mapAttrsToList = f: attrs:
9−in { haskell-nix = prev.haskell-nix // {
7+ map (name: f name attrs.${name}) (__attrNames attrs);
10−
8+in [(
11− hackageQuirks = { name, version }: {
9+ {config, lib, pkgs, ...}:
10+ { _file = "haskell.nix/overlays/hackage-quirks.nix#cabal-install"; } //
12 # FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
11 # FIXME: this is required to build cabal-install 3.2 with ghc 8.6,
13 # but also for
12 # but also for
14 # https://github.com/input-output-hk/haskell.nix/issues/422
13 # https://github.com/input-output-hk/haskell.nix/issues/422
15− cabal-install = {
14+ lib.mkIf (config.name == "cabal-install") {
16− cabalProject = ''
15+ cabalProject = lib.mkDefault ''
17 packages: .
16 packages: .
18 allow-newer: cabal-install:base, *:base, *:template-haskell
17 allow-newer: cabal-install:base, *:base, *:template-haskell
19 '';
18 '';
20 modules = [
19 modules = [
21 # Version of of cabal-install in hackage is broken for GHC 8.10.1
20 # Version of of cabal-install in hackage is broken for GHC 8.10.1
22− (lib.optionalAttrs (version == "3.2.0.0") {
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 = final.haskell-nix.sources.cabal-32 + "/cabal-install";
23+ packages.cabal-install.src = pkgs.buildPackages.haskell-nix.sources.cabal-32 + "/cabal-install";
24 })
24 })
25 ];
25 ];
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) {
27
34
28 # TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
35 # TODO remove this when `dependent-sum-0.7.1.0` constraint on `some` has been updated.
29 # See https://github.com/haskell/haskell-language-server/issues/2969
36 # See https://github.com/haskell/haskell-language-server/issues/2969
@@ -59,7 +66,7 @@ in { haskell-nix = prev.haskell-nix // {
59 flags: +use-pkg-config
66 flags: +use-pkg-config
60 '';
67 '';
61 modules = [(
68 modules = [(
62− {pkgs, ...}: final.lib.mkIf pkgs.stdenv.hostPlatform.isMusl {
69+ {pkgs, lib, ...}: lib.mkIf pkgs.stdenv.hostPlatform.isMusl {
63 # The order of -lssl and -lcrypto is important here
70 # The order of -lssl and -lcrypto is important here
64 packages.postgrest.configureFlags = [
71 packages.postgrest.configureFlags = [
65 "--ghc-option=-optl=-lssl"
72 "--ghc-option=-optl=-lssl"
@@ -78,6 +85,4 @@ in { haskell-nix = prev.haskell-nix // {
78 ];
85 ];
79 };
86 };
80
87
81− }."${name}" or {};
88+ }
82−
83−}; }
modules/plan.nix+7
@@ -299,6 +299,13 @@ in {
299 visible = false;
299 visible = false;
300 internal = true;
300 internal = true;
301 };
301 };
302+
303+ evalPackages = mkOption {
304+ type = unspecified;
305+ description = ''
306+ The `evalPackages` that will be used when building `hoogle` and shell tools.
307+ '';
308+ };
302 };
309 };
303
310
304 config = let module = config.plan.pkg-def config.hackage.configs; in {
311 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, ... }:
2with lib;
2with lib;
3with lib.types;
3with lib.types;
4{
4{
@@ -24,6 +24,40 @@ with lib.types;
24 shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
24 shell = { tools.cabal = {}; crossPlatforms = p: [ p.ghcjs ]; }
25 '';
25 '';
26 };
26 };
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+ };
27 hsPkgs = lib.mkOption {
61 hsPkgs = lib.mkOption {
28 type = lib.types.unspecified;
62 type = lib.types.unspecified;
29 };
63 };
modules/stack-project.nix+2−7
@@ -35,14 +35,9 @@ with types;
35 default = null;
35 default = null;
36 description = "If true the nix files will be generated used to check plan-sha256 and material";
36 description = "If true the nix files will be generated used to check plan-sha256 and material";
37 };
37 };
38− caller = mkOption {
39− type = str;
40− default = "callCabalProjectToNix";
41− description = "Name of the calling function for better warning messages";
42− };
43 nix-tools = mkOption {
38 nix-tools = mkOption {
44− type = nullOr package;
39+ type = package;
45− default = pkgs.evalPackages.haskell-nix.internal-nix-tools;
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)
46 description = "nix-tools to use when converting the `plan.json` to nix";
41 description = "nix-tools to use when converting the `plan.json` to nix";
47 };
42 };
48
43
overlays/bootstrap.nix+19−11
@@ -879,7 +879,8 @@ in {
879 # always has `checkMaterialization = false` to avoid infinite
879 # always has `checkMaterialization = false` to avoid infinite
880 # recursion.
880 # recursion.
881 cabal-install-tool = {compiler-nix-name, ...}@args:
881 cabal-install-tool = {compiler-nix-name, ...}@args:
882− (final.haskell-nix.hackage-package ({
882+ (final.haskell-nix.hackage-package ({pkgs, ...}: {
883+ evalPackages = pkgs.buildPackages;
883 name = "cabal-install";
884 name = "cabal-install";
884 version = "3.6.2.0";
885 version = "3.6.2.0";
885 index-state = final.haskell-nix.internalHackageIndexState;
886 index-state = final.haskell-nix.internalHackageIndexState;
@@ -894,8 +895,8 @@ in {
894 then "ghc8107"
895 then "ghc8107"
895 else args.compiler-nix-name;
896 else args.compiler-nix-name;
896 project =
897 project =
897− final.haskell-nix.cabalProject ({
898+ final.haskell-nix.cabalProject ({pkgs, ...}: {
898− caller = "nix-tools-set";
899+ evalPackages = pkgs.buildPackages;
899 name = "nix-tools";
900 name = "nix-tools";
900 src = {
901 src = {
901 outPath = final.haskell-nix.sources.nix-tools;
902 outPath = final.haskell-nix.sources.nix-tools;
@@ -1053,8 +1054,6 @@ in {
1053 # This compiler-nix-name will only be used to build nix-tools and cabal-install
1054 # This compiler-nix-name will only be used to build nix-tools and cabal-install
1054 # when checking materialization of alex, happy and hscolour.
1055 # when checking materialization of alex, happy and hscolour.
1055 compiler-nix-name = "ghc865";
1056 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};
1058 # The ghc boot compiler to use to compile alex, happy and hscolour
1057 # The ghc boot compiler to use to compile alex, happy and hscolour
1059 ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
1058 ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}";
1060 ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
1059 ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; };
@@ -1098,7 +1097,8 @@ in {
1098 # building ghc itself (since GHC is a dependency
1097 # building ghc itself (since GHC is a dependency
1099 # of the materialization check it would cause
1098 # of the materialization check it would cause
1100 # infinite recursion).
1099 # infinite recursion).
1101− alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({
1100+ alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({pkgs, ...}: {
1101+ evalPackages = pkgs.buildPackages;
1102 version = "3.2.4";
1102 version = "3.2.4";
1103 inherit ghcOverride nix-tools cabal-install index-state;
1103 inherit ghcOverride nix-tools cabal-install index-state;
1104 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
1104 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex";
@@ -1106,23 +1106,31 @@ in {
1106 } // args);
1106 } // args);
1107 alex = bootstrap.packages.alex-tool {};
1107 alex = bootstrap.packages.alex-tool {};
1108 alex-unchecked = bootstrap.packages.alex-tool { checkMaterialization = false; };
1108 alex-unchecked = bootstrap.packages.alex-tool { checkMaterialization = false; };
1109− happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy" ({
1109+ happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy"
1110+ ({config, pkgs, ...}: {
1111+ evalPackages = pkgs.buildPackages;
1110− inherit version ghcOverride nix-tools cabal-install index-state;
1112+ inherit version ghcOverride index-state;
1111 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}";
1113 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}";
1112 modules = [{ reinstallableLibGhc = false; }];
1114 modules = [{ reinstallableLibGhc = false; }];
1115+ nix-tools = config.evalPackages.haskell-nix.nix-tools.${compiler-nix-name};
1116+ cabal-install = config.evalPackages.haskell-nix.cabal-install.${compiler-nix-name};
1113− } // args);
1117+ } // args);
1114 happy = bootstrap.packages.happy-tool {};
1118 happy = bootstrap.packages.happy-tool {};
1115 happy-unchecked = bootstrap.packages.happy-tool { checkMaterialization = false; };
1119 happy-unchecked = bootstrap.packages.happy-tool { checkMaterialization = false; };
1116 # Older version needed when building ghc 8.6.5
1120 # Older version needed when building ghc 8.6.5
1117 happy-old = bootstrap.packages.happy-tool { version = "1.19.11"; };
1121 happy-old = bootstrap.packages.happy-tool { version = "1.19.11"; };
1118 happy-old-unchecked = bootstrap.packages.happy-tool { version = "1.19.11"; checkMaterialization = false; };
1122 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;
1120 compiler-nix-name = buildBootstrapper.compilerNixName;
1126 compiler-nix-name = buildBootstrapper.compilerNixName;
1121 name = "hscolour";
1127 name = "hscolour";
1122 version = "1.24.4";
1128 version = "1.24.4";
1123− inherit ghcOverride nix-tools cabal-install index-state;
1129+ inherit ghcOverride index-state;
1124 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
1130 materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour";
1125 modules = [{ reinstallableLibGhc = false; }];
1131 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};
1126 } // args)).getComponent "exe:HsColour";
1134 } // args)).getComponent "exe:HsColour";
1127 hscolour = bootstrap.packages.hscolour-tool {};
1135 hscolour = bootstrap.packages.hscolour-tool {};
1128 hscolour-unchecked = bootstrap.packages.hscolour-tool { checkMaterialization = false; };
1136 hscolour-unchecked = bootstrap.packages.hscolour-tool { checkMaterialization = false; };
overlays/default.nix−4
@@ -6,7 +6,6 @@ let
6 #ghcjs = import ./ghcjs-asterius-triple.nix;
6 #ghcjs = import ./ghcjs-asterius-triple.nix;
7 #python = import ./python.nix;
7 #python = import ./python.nix;
8 haskell = import ./haskell.nix args;
8 haskell = import ./haskell.nix args;
9− hackage-quirks = import ./hackage-quirks.nix;
10 bootstrap = import ./bootstrap.nix;
9 bootstrap = import ./bootstrap.nix;
11 ghc = import ./ghc.nix;
10 ghc = import ./ghc.nix;
12 ghc-packages = import ./ghc-packages.nix;
11 ghc-packages = import ./ghc-packages.nix;
@@ -21,7 +20,6 @@ let
21 nix-prefetch-git-minimal = import ./nix-prefetch-git-minimal.nix;
20 nix-prefetch-git-minimal = import ./nix-prefetch-git-minimal.nix;
22 gobject-introspection = import ./gobject-introspection.nix;
21 gobject-introspection = import ./gobject-introspection.nix;
23 hix = import ./hix.nix;
22 hix = import ./hix.nix;
24− eval-packages = import ./eval-packages.nix combined;
25 ghcjs = import ./ghcjs.nix;
23 ghcjs = import ./ghcjs.nix;
26 };
24 };
27
25
@@ -41,7 +39,6 @@ let
41 })
39 })
42 wine
40 wine
43 haskell
41 haskell
44− hackage-quirks
45 bootstrap
42 bootstrap
46 ghc
43 ghc
47 ghc-packages
44 ghc-packages
@@ -56,7 +53,6 @@ let
56 ghcjs
53 ghcjs
57 gobject-introspection
54 gobject-introspection
58 hix
55 hix
59− eval-packages
60 hydra
56 hydra
61 # Restore nixpkgs haskell and haskellPackages
57 # Restore nixpkgs haskell and haskellPackages
62 (_: prev: { inherit (prev.haskell-nix-prev) haskell haskellPackages; })
58 (_: 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 @@
1final: prev:
1final: prev:
2let
2let
3− callCabal2Nix = compiler-nix-name: name: src: final.evalPackages.stdenv.mkDerivation {
3+ callCabal2Nix = compiler-nix-name: name: src: final.buildPackages.stdenv.mkDerivation {
4 name = "${name}-package.nix";
4 name = "${name}-package.nix";
5 inherit src;
5 inherit src;
6 nativeBuildInputs = [
6 nativeBuildInputs = [
7 # It is not safe to check the nix-tools materialization here
7 # It is not safe to check the nix-tools materialization here
8 # as we would need to run this code to do so leading to
8 # as we would need to run this code to do so leading to
9 # infinite recursion (so using nix-tools-unchecked).
9 # 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}
11 ];
11 ];
12 phases = [ "unpackPhase" "buildPhase" ];
12 phases = [ "unpackPhase" "buildPhase" ];
13
13
@@ -32,7 +32,7 @@ let
32 name = name + ext;
32 name = name + ext;
33 inherit path;
33 inherit path;
34 }) files);
34 }) files);
35− in final.evalPackages.runCommand "${name}${ext}" {} ''
35+ in final.buildPackages.runCommand "${name}${ext}" {} ''
36 cp -Lr ${links} $out
36 cp -Lr ${links} $out
37 chmod -R +w $out
37 chmod -R +w $out
38 '';
38 '';
@@ -117,14 +117,14 @@ in rec {
117 let nix24srcFix = src: src // { filterPath = { path, ... }: path; };
117 let nix24srcFix = src: src // { filterPath = { path, ... }: path; };
118 # Add in the generated files needed by ghc-boot
118 # Add in the generated files needed by ghc-boot
119 in if subDir == "libraries/ghc-boot"
119 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]; } ''
121 mkdir $out
121 mkdir $out
122 lndir -silent ${ghc.passthru.configured-src}/${subDir} $out
122 lndir -silent ${ghc.passthru.configured-src}/${subDir} $out
123 lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC
123 lndir -silent ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC $out/GHC
124 '')
124 '')
125 else if subDir == "compiler"
125 else if subDir == "compiler"
126 then final.haskell-nix.haskellLib.cleanSourceWith {
126 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]; } ''
128 mkdir $out
128 mkdir $out
129 lndir -silent ${ghc.passthru.configured-src} $out
129 lndir -silent ${ghc.passthru.configured-src} $out
130 if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs ]]; then
130 if [[ -f ${ghc.generated}/libraries/ghc-boot/dist-install/build/GHC/Version.hs ]]; then
@@ -213,7 +213,8 @@ in rec {
213
213
214 # A `cabalProject'` project for each ghc
214 # A `cabalProject'` project for each ghc
215 ghc-extra-projects = builtins.mapAttrs (ghcName: proj:
215 ghc-extra-projects = builtins.mapAttrs (ghcName: proj:
216− final.haskell-nix.cabalProject' {
216+ final.haskell-nix.cabalProject' ({pkgs, ...}: {
217+ evalPackages = pkgs.buildPackages;
217 name = "ghc-extra-projects-${ghc-extra-projects-type}-${ghcName}";
218 name = "ghc-extra-projects-${ghc-extra-projects-type}-${ghcName}";
218 src = proj;
219 src = proj;
219 inherit (proj) cabalProject;
220 inherit (proj) cabalProject;
@@ -227,7 +228,7 @@ in rec {
227 compiler-nix-name = ghcName;
228 compiler-nix-name = ghcName;
228 configureArgs = "--disable-tests --disable-benchmarks --allow-newer='terminfo:base'"; # avoid failures satisfying bytestring package tests dependencies
229 configureArgs = "--disable-tests --disable-benchmarks --allow-newer='terminfo:base'"; # avoid failures satisfying bytestring package tests dependencies
229 modules = [{ reinstallableLibGhc = false; }];
230 modules = [{ reinstallableLibGhc = false; }];
230− })
231+ }))
231 ghc-extra-pkgs-cabal-projects;
232 ghc-extra-pkgs-cabal-projects;
232
233
233 # The packages from the project for each ghc
234 # The packages from the project for each ghc
overlays/haskell.nix+32−74
@@ -189,7 +189,7 @@ final: prev: {
189 hackageTarball = { index-state, sha256, nix-tools ? final.haskell-nix.nix-tools, ... }:
189 hackageTarball = { index-state, sha256, nix-tools ? final.haskell-nix.nix-tools, ... }:
190 assert sha256 != null;
190 assert sha256 != null;
191 let at = builtins.replaceStrings [":"] [""] index-state; in
191 let at = builtins.replaceStrings [":"] [""] index-state; in
192− { "hackage.haskell.org-at-${at}" = final.evalPackages.fetchurl {
192+ { "hackage.haskell.org-at-${at}" = final.fetchurl {
193 name = "01-index.tar.gz-at-${at}";
193 name = "01-index.tar.gz-at-${at}";
194 url = "https://hackage.haskell.org/01-index.tar.gz";
194 url = "https://hackage.haskell.org/01-index.tar.gz";
195 downloadToTemp = true;
195 downloadToTemp = true;
@@ -211,7 +211,7 @@ final: prev: {
211 # dotCabalName anyway.
211 # dotCabalName anyway.
212 dotCabalName = "dot-cabal-" + allNames;
212 dotCabalName = "dot-cabal-" + allNames;
213 # This is very big, and cheap to build: prefer building it locally
213 # 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; } ''
215 mkdir -p $out/.cabal
215 mkdir -p $out/.cabal
216 cat <<EOF > $out/.cabal/config
216 cat <<EOF > $out/.cabal/config
217 ${final.lib.concatStrings (
217 ${final.lib.concatStrings (
@@ -239,7 +239,7 @@ final: prev: {
239 '';
239 '';
240 in
240 in
241 # Add the extra-hackage-repos where we have all the files needed.
241 # 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 ]; } ''
243 mkdir $out
243 mkdir $out
244 lndir ${tarballRepos} $out
244 lndir ${tarballRepos} $out
245
245
@@ -261,10 +261,9 @@ final: prev: {
261
261
262 # Helps materialize the output of derivations
262 # Helps materialize the output of derivations
263 materialize = import ../lib/materialize.nix {
263 materialize = import ../lib/materialize.nix {
264+ pkgs = final;
264− inherit (final.evalPackages) nix;
265+ inherit (final) nix runCommand writeShellScript;
265 inherit (final.haskell-nix) checkMaterialization;
266 inherit (final.haskell-nix) checkMaterialization;
266− pkgs = final.evalPackages.pkgs;
267− inherit (final.evalPackages.pkgs) runCommand writeShellScript;
268 };
267 };
269
268
270 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
269 update-index-state-hashes = import ../scripts/update-index-state-hashes.nix {
@@ -275,11 +274,7 @@ final: prev: {
275 };
274 };
276
275
277 # Function to call stackToNix
276 # Function to call stackToNix
278− callStackToNix = import ../lib/call-stack-to-nix.nix {
277+ 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− };
283
278
284 # given a source location call `cabal-to-nix` (from nix-tools) on it
279 # given a source location call `cabal-to-nix` (from nix-tools) on it
285 # to produce the nix representation of it.
280 # to produce the nix representation of it.
@@ -325,7 +320,7 @@ final: prev: {
325 # pkgs.fetchgit doesn't have any way of fetching from a given
320 # pkgs.fetchgit doesn't have any way of fetching from a given
326 # ref.
321 # ref.
327 assert isNull ref;
322 assert isNull ref;
328− final.evalPackages.fetchgit {
323+ final.fetchgit {
329 url = url;
324 url = url;
330 rev = rev;
325 rev = rev;
331 sha256 = sha256;
326 sha256 = sha256;
@@ -382,10 +377,7 @@ final: prev: {
382 }
377 }
383 '';
378 '';
384
379
385− genStackCache = import ../lib/stack-cache-generator.nix {
380+ genStackCache = import ../lib/stack-cache-generator.nix;
386− inherit (final.evalPackages) pkgs;
387− inherit (final.evalPackages.haskell-nix) haskellLib;
388− };
389
381
390 mkCacheModule = cache:
382 mkCacheModule = cache:
391 # for each item in the `cache`, set
383 # for each item in the `cache`, set
@@ -414,7 +406,7 @@ final: prev: {
414 final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
406 final.buildPackages.lib.optionalAttrs (ref != null) { inherit ref; }
415 )
407 )
416 else
408 else
417− final.evalPackages.fetchgit { inherit url rev sha256; };
409+ final.fetchgit { inherit url rev sha256; };
418 } // final.buildPackages.lib.optionalAttrs (subdir != null && subdir != ".") { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
410 } // final.buildPackages.lib.optionalAttrs (subdir != null && subdir != ".") { postUnpack = "sourceRoot+=/${subdir}; echo source root reset to $sourceRoot"; };
419 };
411 };
420
412
@@ -428,11 +420,9 @@ final: prev: {
428 # Resulting nix files are added to nix-plan subdirectory.
420 # Resulting nix files are added to nix-plan subdirectory.
429 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
421 callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
430 index-state-hashes = import indexStateHashesPath;
422 index-state-hashes = import indexStateHashesPath;
431− inherit (final.buildPackages.haskell-nix) haskellLib materialize;
423+ inherit (final.buildPackages.haskell-nix) haskellLib;
432 pkgs = final.buildPackages.pkgs;
424 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;
436 };
426 };
437
427
438 # Loads a plan and filters the package directories using cleanSourceWith
428 # Loads a plan and filters the package directories using cleanSourceWith
@@ -455,60 +445,22 @@ final: prev: {
455 # the index-state-hashes is used. This guarantees reproducibility wrt
445 # the index-state-hashes is used. This guarantees reproducibility wrt
456 # to the haskell.nix revision. If reproducibility beyond haskell.nix
446 # to the haskell.nix revision. If reproducibility beyond haskell.nix
457 # is required, a specific index-state should be provided!
447 # is required, a specific index-state should be provided!
458− hackage-package =
448+ hackage-package = projectModule:
459− { name, compiler-nix-name, ... }@args':
449+ let project = hackage-project projectModule;
460− let args = { caller = "hackage-package"; } // args';
461− in (hackage-project args).getPackage name;
450+ in project.getPackage project.args.name;
462− hackage-project =
451+ hackage-project = projectModule:
463− { name
452+ cabalProject' ([
464− , compiler-nix-name
453+ (import ../modules/hackage-project.nix)
465− , version ? "latest"
454+ ] ++ (import ../modules/hackage-quirks.nix)
466− , revision ? "default"
455+ ++ (if builtins.isList projectModule then projectModule else [projectModule]));
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; });
503
456
504 # This function is like `cabalProject` but it makes the plan-nix available
457 # This function is like `cabalProject` but it makes the plan-nix available
505 # separately from the hsPkgs. The advantage is that the you can get the
458 # separately from the hsPkgs. The advantage is that the you can get the
506 # plan-nix without building the project.
459 # plan-nix without building the project.
507 cabalProject' =
460 cabalProject' =
508 projectModule: haskellLib.evalProjectModule ../modules/cabal-project.nix projectModule (
461 projectModule: haskellLib.evalProjectModule ../modules/cabal-project.nix projectModule (
509− { src, compiler-nix-name, ... }@args':
462+ { src, compiler-nix-name, evalPackages, ... }@args:
510 let
463 let
511− args = { caller = "cabalProject'"; } // args';
512 callProjectResults = callCabalProjectToNix args;
464 callProjectResults = callCabalProjectToNix args;
513 plan-pkgs = importAndFilterProject {
465 plan-pkgs = importAndFilterProject {
514 inherit (callProjectResults) projectNix sourceRepos src;
466 inherit (callProjectResults) projectNix sourceRepos src;
@@ -522,6 +474,7 @@ final: prev: {
522 config = {
474 config = {
523 compiler.nix-name = compiler-nix-name;
475 compiler.nix-name = compiler-nix-name;
524 hsPkgs = {};
476 hsPkgs = {};
477+ inherit evalPackages;
525 };
478 };
526 }
479 }
527 else mkCabalProjectPkgSet
480 else mkCabalProjectPkgSet
@@ -531,7 +484,10 @@ final: prev: {
531 ++ (args.modules or [])
484 ++ (args.modules or [])
532 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
485 ++ final.lib.optional (args.ghcOverride != null || args.ghc != null)
533 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
486 { ghc.package = if args.ghcOverride != null then args.ghcOverride else args.ghc; }
487+ ++ [ {
534− ++ [ { compiler.nix-name = final.lib.mkForce args.compiler-nix-name; } ];
488+ compiler.nix-name = final.lib.mkForce args.compiler-nix-name;
489+ evalPackages = final.lib.mkDefault evalPackages;
490+ } ];
535 extra-hackages = args.extra-hackages or [] ++ callProjectResults.extra-hackages;
491 extra-hackages = args.extra-hackages or [] ++ callProjectResults.extra-hackages;
536 };
492 };
537
493
@@ -708,7 +664,7 @@ final: prev: {
708 # not exist at all). The derivation will never build
664 # not exist at all). The derivation will never build
709 # and simple outputs the result of cabal configure.
665 # and simple outputs the result of cabal configure.
710 getComponent = componentName:
666 getComponent = componentName:
711− final.evalPackages.runCommand "cabal-configure-error" {
667+ final.rawProject.config.evalPackages.runCommand "cabal-configure-error" {
712 passthru = {
668 passthru = {
713 inherit project package;
669 inherit project package;
714 };
670 };
@@ -807,7 +763,7 @@ final: prev: {
807
763
808 stackProject' =
764 stackProject' =
809 projectModule: haskellLib.evalProjectModule ../modules/stack-project.nix projectModule (
765 projectModule: haskellLib.evalProjectModule ../modules/stack-project.nix projectModule (
810− { src, ... }@args:
766+ { src, evalPackages, ... }@args:
811 let callProjectResults = callStackToNix (args
767 let callProjectResults = callStackToNix (args
812 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
768 // final.lib.optionalAttrs (args.cache == null) { inherit cache; });
813 generatedCache = genStackCache args;
769 generatedCache = genStackCache args;
@@ -824,7 +780,8 @@ final: prev: {
824 ++ (args.modules or [])
780 ++ (args.modules or [])
825 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
781 ++ final.lib.optional (args.ghc != null) { ghc.package = args.ghc; }
826 ++ final.lib.optional (args.compiler-nix-name != null)
782 ++ 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; } ];
828 };
785 };
829
786
830 project = addProjectAndPackageAttrs {
787 project = addProjectAndPackageAttrs {
@@ -860,6 +817,7 @@ final: prev: {
860 (import ../modules/stack-project.nix)
817 (import ../modules/stack-project.nix)
861 (import ../modules/cabal-project.nix)
818 (import ../modules/cabal-project.nix)
862 (import ../modules/project.nix)
819 (import ../modules/project.nix)
820+ {_module.args.pkgs = final;} # Needed to make `src = config.evalPackages.haskell-nix.haskellLib.cleanGit ...` work
863 ] ++ projectModule';
821 ] ++ projectModule';
864 }).config) src projectFileName;
822 }).config) src projectFileName;
865 dir = __readDir (src.origSrcSubDir or src);
823 dir = __readDir (src.origSrcSubDir or src);
@@ -881,12 +839,12 @@ final: prev: {
881 if final.lib.hasSuffix ".yaml" selectedFileName
839 if final.lib.hasSuffix ".yaml" selectedFileName
882 then stackProject' ([
840 then stackProject' ([
883 (import ../modules/project.nix)
841 (import ../modules/project.nix)
884− { caller = "project'"; stackYaml = selectedFileName; }
842+ { stackYaml = selectedFileName; }
885 ] ++ projectModule'
843 ] ++ projectModule'
886 )
844 )
887 else cabalProject' ([
845 else cabalProject' ([
888 (import ../modules/project.nix)
846 (import ../modules/project.nix)
889− { caller = "project'"; cabalProjectFileName = selectedFileName; }
847+ { cabalProjectFileName = selectedFileName; }
890 ] ++ projectModule');
848 ] ++ projectModule');
891
849
892 # This is the same as the `cabalPackage` and `stackPackage` wrappers
850 # 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 = {
39 (import ../modules/hix-project.nix)
39 (import ../modules/hix-project.nix)
40 projectDefaults
40 projectDefaults
41 commandArgs'
41 commandArgs'
42− {
42+ ({config, ...}: {
43 src =
43 src =
44 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
44 if __pathExists (toString (src.origSrcSubDir or src) + "/.git")
45− then final.haskell-nix.haskellLib.cleanGit {
45+ then config.evalPackages.haskell-nix.haskellLib.cleanGit {
46 inherit src name;
46 inherit src name;
47 }
47 }
48 else src;
48 else src;
49− }
49+ })
50 ];
50 ];
51}; }; }
51}; }; }
overlays/nix-prefetch-git-minimal.nix+14
@@ -21,6 +21,20 @@ final: prev: {
21 git = final.gitMinimal;
21 git = final.gitMinimal;
22 }) nix-prefetch-git;
22 }) nix-prefetch-git;
23
23
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+
24 # Find uses of the non minimal git package by uncommenting this:
38 # Find uses of the non minimal git package by uncommenting this:
25 # git = prev.intentional-error-here;
39 # git = prev.intentional-error-here;
26 # gitMinimal = final.gitAndTools.git.override {
40 # gitMinimal = final.gitAndTools.git.override {
overlays/tools.nix+25−43
@@ -57,50 +57,32 @@ in { haskell-nix = prev.haskell-nix // {
57 cabal-install = "cabal";
57 cabal-install = "cabal";
58 };
58 };
59
59
60− hackage-tool = { name, ... }@args':
60+ hackage-tool = projectModules:
61 let
61 let
62− args = { caller = "hackage-tool"; } // args';
62+ package = final.haskell-nix.hackage-package (projectModules ++ [
63− in
63+ ({lib, ...}: {
64+ options.name = lib.mkOption {
64− (final.haskell-nix.hackage-package
65+ apply = n: final.haskell-nix.toolPackageName.${n} or n;
66+ };
67+ config = {
65− ( # Disable benchmarks and tests by default (since we only want the exe component)
68+ # Disable benchmarks and tests by default (since we only want the exe component)
66− { configureArgs = "--disable-benchmarks --disable-tests"; }
69+ configureArgs = "--disable-benchmarks --disable-tests";
67− // args
70+ };
68− // { name = final.haskell-nix.toolPackageName.${name} or name; }))
71+ })
72+ ]);
73+ name = package.project.args.name;
69− .getComponent "exe:${final.haskell-nix.packageToolName.${name} or name}";
74+ exeName = final.haskell-nix.packageToolName.${name} or name;
75+ in package.getComponent "exe:${exeName}";
70
76
71− tool = compiler-nix-name: name: versionOrArgs:
77+ tool = compiler-nix-name: name: versionOrMod:
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; });
78+ final.haskell-nix.hackage-tool (
80−
79+ final.haskell-nix.haskellLib.versionOrModToMods versionOrMod
81− tools = compiler-nix-name: lib.mapAttrs (final.haskell-nix.tool compiler-nix-name);
80+ ++ [{ inherit compiler-nix-name name; }]
81+ );
82
82
83− # Like `tools` but allows default ghc to be specified
83+ tools = evalPackages: compiler-nix-name:
84− toolsForGhc = ghcOverride: toolSet:
85− final.haskell-nix.tools (
86− lib.mapAttrs (name: versionOrArgs:
84+ lib.mapAttrs (name: versionOrMod:
85+ final.haskell-nix.hackage-tool (
87− let args = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs;
86+ final.haskell-nix.haskellLib.versionOrModToMods versionOrMod
88− in
87+ ++ [{ inherit evalPackages compiler-nix-name name; }]));
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− };
106}; }
88}; }
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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "buildable";
8 src = testSrc "buildable";
9 modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
9 modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
10 };
10 };
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 }:
2
2
3with lib;
3with lib;
4
4
@@ -23,6 +23,8 @@ let
23 # Check that the package option works
23 # Check that the package option works
24 packages.stm.doHaddock = false;
24 packages.stm.doHaddock = false;
25 }
25 }
26+
27+ { inherit evalPackages; }
26 ];
28 ];
27 };
29 };
28
30
test/c-ffi/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
@@ -13,7 +13,7 @@ let
13 ];
13 ];
14
14
15 project = project' {
15 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
17 src = testSrc "c-ffi";
17 src = testSrc "c-ffi";
18 inherit modules;
18 inherit modules;
19 };
19 };
test/ca-derivations-include/default.nix+3−3
@@ -1,6 +1,6 @@
1# Build a project enabling content addressed derivations for
1# Build a project enabling content addressed derivations for
2# only a subset of the components
2# 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 }:
4
4
5with lib;
5with lib;
6
6
@@ -15,13 +15,13 @@ let
15
15
16 # each derivation is content addressed
16 # each derivation is content addressed
17 projectA = project' {
17 projectA = project' {
18− inherit compiler-nix-name src cabalProject;
18+ inherit compiler-nix-name evalPackages src cabalProject;
19 modules = [{ contentAddressed = true; }];
19 modules = [{ contentAddressed = true; }];
20 };
20 };
21
21
22 # each derivation but one (the executable) is content addressed
22 # each derivation but one (the executable) is content addressed
23 projectB = project' {
23 projectB = project' {
24− inherit compiler-nix-name src cabalProject;
24+ inherit compiler-nix-name evalPackages src cabalProject;
25 modules = [{
25 modules = [{
26 contentAddressed = true;
26 contentAddressed = true;
27 packages.cabal-simple.components.exes.cabal-simple.contentAddressed = false;
27 packages.cabal-simple.components.exes.cabal-simple.contentAddressed = false;
test/ca-derivations/default.nix+3−3
@@ -1,6 +1,6 @@
1# Test if derivations are content addressed building two derivations producing
1# Test if derivations are content addressed building two derivations producing
2# the same outputs and checking if the path stores are equals
2# 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 }:
4
4
5with lib;
5with lib;
6
6
@@ -21,13 +21,13 @@ let
21 '';
21 '';
22
22
23 projectPlain = project' {
23 projectPlain = project' {
24− inherit compiler-nix-name cabalProject;
24+ inherit compiler-nix-name evalPackages cabalProject;
25 src = srcPlain;
25 src = srcPlain;
26 modules = [{ contentAddressed = true; }];
26 modules = [{ contentAddressed = true; }];
27 };
27 };
28
28
29 projectWithComment = project' {
29 projectWithComment = project' {
30− inherit compiler-nix-name cabalProject;
30+ inherit compiler-nix-name evalPackages cabalProject;
31 src = srcWithComment;
31 src = srcWithComment;
32 modules = [{ contentAddressed = true; }];
32 modules = [{ contentAddressed = true; }];
33 };
33 };
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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "cabal-22";
8 src = testSrc "cabal-22";
9 };
9 };
10
10
test/cabal-doctests/default.nix+2−2
@@ -1,12 +1,12 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project =
7 project =
8 cabalProject' {
8 cabalProject' {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
10 src = testSrc "cabal-doctests";
10 src = testSrc "cabal-doctests";
11 index-state = "2021-01-11T00:00:00Z";
11 index-state = "2021-01-11T00:00:00Z";
12 };
12 };
test/cabal-hpack/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
@@ -13,7 +13,7 @@ let
13 ];
13 ];
14
14
15 project = project' {
15 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
17 src = testSrc "cabal-hpack";
17 src = testSrc "cabal-hpack";
18 inherit modules;
18 inherit modules;
19 };
19 };
test/cabal-simple-debug/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = cabalProject' {
7 project = cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "cabal-simple-debug";
9 src = testSrc "cabal-simple-debug";
10 cabalProject = ''
10 cabalProject = ''
11 packages: .
11 packages: .
test/cabal-simple-prof/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
@@ -16,7 +16,7 @@ let
16 ];
16 ];
17
17
18 project = cabalProject' {
18 project = cabalProject' {
19− inherit compiler-nix-name;
19+ inherit compiler-nix-name evalPackages;
20 src = testSrc "cabal-simple-prof";
20 src = testSrc "cabal-simple-prof";
21 inherit modules;
21 inherit modules;
22 cabalProject = ''
22 cabalProject = ''
test/cabal-simple/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
@@ -13,7 +13,7 @@ let
13 ];
13 ];
14
14
15 project = project' {
15 project = project' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
17 src = testSrc "cabal-simple";
17 src = testSrc "cabal-simple";
18 inherit modules;
18 inherit modules;
19 cabalProject = ''
19 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "cabal-source-repo-comments";
8 src = testSrc "cabal-source-repo-comments";
9 };
9 };
10 packages = project.hsPkgs;
10 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "cabal-source-repo";
8 src = testSrc "cabal-source-repo";
9 };
9 };
10 packages = project.hsPkgs;
10 packages = project.hsPkgs;
test/cabal-sublib/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
@@ -14,7 +14,7 @@ let
14
14
15 # The ./pkgs.nix works for linux & darwin, but not for windows
15 # The ./pkgs.nix works for linux & darwin, but not for windows
16 project = cabalProject' {
16 project = cabalProject' {
17− inherit compiler-nix-name;
17+ inherit compiler-nix-name evalPackages;
18 src = testSrc "cabal-sublib";
18 src = testSrc "cabal-sublib";
19 inherit modules;
19 inherit modules;
20 cabalProject = ''
20 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 }:
2
2
3with lib;
3with lib;
4
4
@@ -6,7 +6,7 @@ let
6 # This test could use cabalProject', but it does so that it
6 # This test could use cabalProject', but it does so that it
7 # tests using callCabalProjectToNix and importAndFilterProject
7 # tests using callCabalProjectToNix and importAndFilterProject
8 callProjectResults = callCabalProjectToNix {
8 callProjectResults = callCabalProjectToNix {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
10 # reuse the cabal-simple test project
10 # reuse the cabal-simple test project
11 src = testSrc "cabal-simple";
11 src = testSrc "cabal-simple";
12 cabalProject = ''
12 cabalProject = ''
@@ -18,6 +18,7 @@ let
18 plan-pkgs = importAndFilterProject {
18 plan-pkgs = importAndFilterProject {
19 inherit (callProjectResults) projectNix sourceRepos src;
19 inherit (callProjectResults) projectNix sourceRepos src;
20 };
20 };
21+ modules = [{ inherit evalPackages; }];
21 };
22 };
22 packages = pkgSet.config.hsPkgs;
23 packages = pkgSet.config.hsPkgs;
23
24
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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 callProjectResults = callStackToNix {
6 callProjectResults = callStackToNix {
7 src = testSrc "stack-simple";
7 src = testSrc "stack-simple";
8+ inherit evalPackages;
8 };
9 };
9 pkgSet = mkStackPkgSet {
10 pkgSet = mkStackPkgSet {
10 stack-pkgs = importAndFilterProject callProjectResults;
11 stack-pkgs = importAndFilterProject callProjectResults;
11 pkg-def-extras = [];
12 pkg-def-extras = [];
12− modules = [];
13+ modules = [{inherit evalPackages;}];
13 };
14 };
14 packages = pkgSet.config.hsPkgs;
15 packages = pkgSet.config.hsPkgs;
15
16
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 }:
2
2
3with lib;
3with lib;
4
4
@@ -9,7 +9,7 @@ let
9 inherit (buildPackages.buildPackages) jq git;
9 inherit (buildPackages.buildPackages) jq git;
10
10
11 hpc-coveralls-exes = (buildPackages.haskell-nix.project' {
11 hpc-coveralls-exes = (buildPackages.haskell-nix.project' {
12− inherit compiler-nix-name;
12+ inherit compiler-nix-name evalPackages;
13 src = sources.hpc-coveralls;
13 src = sources.hpc-coveralls;
14 }).hsPkgs.hpc-coveralls.components.exes;
14 }).hsPkgs.hpc-coveralls.components.exes;
15
15
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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 projectArgs = {
6 projectArgs = {
7+ inherit evalPackages;
7 src = testSrc "coverage-no-libs";
8 src = testSrc "coverage-no-libs";
8 modules = [{
9 modules = [{
9 # Package has no exposed modules which causes
10 # 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 projectArgs = {
6 projectArgs = {
7+ inherit evalPackages;
7 src = testSrc "coverage";
8 src = testSrc "coverage";
8 modules = [{
9 modules = [{
9 # Package has no exposed modules which causes
10 # Package has no exposed modules which causes
test/default.nix+52−51
@@ -7,6 +7,7 @@
7 permittedInsecurePackages = ["libdwarf-20210528" "libdwarf-20181024" "dwarfdump-20181024"];
7 permittedInsecurePackages = ["libdwarf-20210528" "libdwarf-20181024" "dwarfdump-20181024"];
8 };
8 };
9 }
9 }
10+, evalPackages ? import pkgs.path nixpkgsArgs
10, ifdLevel ? 1000
11, ifdLevel ? 1000
11, compiler-nix-name
12, compiler-nix-name
12, CADerivationsEnabled ? false
13, CADerivationsEnabled ? false
@@ -53,7 +54,7 @@ let
53 else val
54 else val
54 );
55 );
55
56
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}; };
57
58
58 # Map the values in an association list over the withIfdInputs function.
59 # Map the values in an association list over the withIfdInputs function.
59 #
60 #
@@ -144,21 +145,21 @@ let
144 then filterNonIfdInputsValues attrs
145 then filterNonIfdInputsValues attrs
145 else attrs;
146 else attrs;
146
147
147− testSrcRoot = haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; };
148+ testSrcRoot = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../.; subDir = "test"; };
148 testSrc = subDir: haskell-nix.haskellLib.cleanSourceWith { src = testSrcRoot; inherit subDir; };
149 testSrc = subDir: haskell-nix.haskellLib.cleanSourceWith { src = testSrcRoot; inherit subDir; };
149 # Use the following reproduce issues that may arise on hydra as a
150 # Use the following reproduce issues that may arise on hydra as a
150 # result of building a snapshot not a git repo.
151 # result of building a snapshot not a git repo.
151 # testSrcRoot = pkgs.copyPathToStore ./.;
152 # testSrcRoot = pkgs.copyPathToStore ./.;
152 # testSrc = subDir: testSrcRoot + "/${subDir}";
153 # 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; };
154 testSrcWithGitDir = subDir: haskell-nix.haskellLib.cleanSourceWith { src = testSrcRootWithGitDir; inherit subDir; includeSiblings = true; };
155 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; });
156
157
157 # Run unit tests with: nix-instantiate --eval --strict -A unit.tests
158 # Run unit tests with: nix-instantiate --eval --strict -A unit.tests
158 # An empty list means success.
159 # An empty list means success.
159 unitTests =
160 unitTests =
160 let
161 let
161− tests = haskell-nix.callPackage ./unit.nix { inherit compiler-nix-name; };
162+ tests = haskell-nix.callPackage ./unit.nix { inherit compiler-nix-name evalPackages; };
162 testsFailedEcho = lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests;
163 testsFailedEcho = lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests;
163 testsFinalLine = if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1";
164 testsFinalLine = if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1";
164 testsScript = testsFailedEcho + testsFinalLine;
165 testsScript = testsFailedEcho + testsFinalLine;
@@ -167,53 +168,53 @@ let
167
168
168 # All tests.
169 # All tests.
169 allTests = {
170 allTests = {
170− cabal-simple = callTest ./cabal-simple { inherit util compiler-nix-name; };
171+ cabal-simple = callTest ./cabal-simple { inherit util; };
171− cabal-simple-debug = callTest ./cabal-simple-debug { inherit util compiler-nix-name; };
172+ cabal-simple-debug = callTest ./cabal-simple-debug { inherit util; };
172− cabal-simple-prof = callTest ./cabal-simple-prof { inherit util compiler-nix-name; };
173+ cabal-simple-prof = callTest ./cabal-simple-prof { inherit util; };
173− cabal-sublib = callTest ./cabal-sublib { inherit util compiler-nix-name; };
174+ cabal-sublib = callTest ./cabal-sublib { inherit util; };
174− with-packages = callTest ./with-packages { inherit util compiler-nix-name; };
175+ with-packages = callTest ./with-packages { inherit util; };
175− builder-haddock = callTest ./builder-haddock { inherit compiler-nix-name; };
176+ builder-haddock = callTest ./builder-haddock {};
176− stack-simple = callTest ./stack-simple { inherit compiler-nix-name; };
177+ stack-simple = callTest ./stack-simple {};
177− stack-local-resolver = callTest ./stack-local-resolver { inherit compiler-nix-name; };
178+ stack-local-resolver = callTest ./stack-local-resolver {};
178− stack-local-resolver-subdir = callTest ./stack-local-resolver-subdir { inherit compiler-nix-name; };
179+ stack-local-resolver-subdir = callTest ./stack-local-resolver-subdir {};
179− stack-remote-resolver = callTest ./stack-remote-resolver { inherit compiler-nix-name; };
180+ stack-remote-resolver = callTest ./stack-remote-resolver {};
180− shell-for-setup-deps = callTest ./shell-for-setup-deps { inherit compiler-nix-name; };
181+ shell-for-setup-deps = callTest ./shell-for-setup-deps {};
181− setup-deps = import ./setup-deps { inherit pkgs compiler-nix-name; };
182+ setup-deps = import ./setup-deps { inherit pkgs evalPackages compiler-nix-name; };
182− callStackToNix = callTest ./call-stack-to-nix { inherit compiler-nix-name; };
183+ callStackToNix = callTest ./call-stack-to-nix {};
183− callCabalProjectToNix = callTest ./call-cabal-project-to-nix { inherit compiler-nix-name; };
184+ callCabalProjectToNix = callTest ./call-cabal-project-to-nix { inherit evalPackages; };
184− cabal-source-repo = callTest ./cabal-source-repo { inherit compiler-nix-name; };
185+ cabal-source-repo = callTest ./cabal-source-repo {};
185− cabal-source-repo-comments = callTest ./cabal-source-repo-comments { inherit compiler-nix-name; };
186+ cabal-source-repo-comments = callTest ./cabal-source-repo-comments {};
186− buildable = callTest ./buildable { inherit compiler-nix-name; };
187+ buildable = callTest ./buildable {};
187− project-flags-cabal = callTest ./project-flags/cabal.nix { inherit compiler-nix-name; };
188+ project-flags-cabal = callTest ./project-flags/cabal.nix {};
188− project-flags-stack = callTest ./project-flags/stack.nix { inherit compiler-nix-name; };
189+ project-flags-stack = callTest ./project-flags/stack.nix {};
189− ghc-options-cabal = callTest ./ghc-options/cabal.nix { inherit compiler-nix-name; };
190+ ghc-options-cabal = callTest ./ghc-options/cabal.nix {};
190− ghc-options-stack = callTest ./ghc-options/stack.nix { inherit compiler-nix-name; };
191+ ghc-options-stack = callTest ./ghc-options/stack.nix {};
191− exe-only = callTest ./exe-only { inherit util compiler-nix-name; };
192+ exe-only = callTest ./exe-only { inherit util; };
192− stack-source-repo = callTest ./stack-source-repo { inherit compiler-nix-name; };
193+ stack-source-repo = callTest ./stack-source-repo {};
193− cabal-doctests = callTest ./cabal-doctests { inherit util compiler-nix-name; };
194+ cabal-doctests = callTest ./cabal-doctests { inherit util; };
194− extra-hackage = callTest ./extra-hackage { inherit compiler-nix-name; };
195+ extra-hackage = callTest ./extra-hackage {};
195− ghcjs-overlay = callTest ./ghcjs-overlay { inherit compiler-nix-name; };
196+ ghcjs-overlay = callTest ./ghcjs-overlay {};
196− hls-cabal = callTest ./haskell-language-server/cabal.nix { inherit compiler-nix-name; };
197+ hls-cabal = callTest ./haskell-language-server/cabal.nix {};
197− hls-stack = callTest ./haskell-language-server/stack.nix { inherit compiler-nix-name; };
198+ hls-stack = callTest ./haskell-language-server/stack.nix {};
198− cabal-hpack = callTest ./cabal-hpack { inherit util compiler-nix-name; };
199+ cabal-hpack = callTest ./cabal-hpack { inherit util; };
199− index-state = callTest ./index-state { inherit compiler-nix-name; };
200+ index-state = callTest ./index-state {};
200− sha256map = callTest ./sha256map { inherit compiler-nix-name; };
201+ sha256map = callTest ./sha256map {};
201 # fully-static = callTest ./fully-static { inherit (pkgs) buildPackages; };
202 # fully-static = callTest ./fully-static { inherit (pkgs) buildPackages; };
202− shell-for = callTest ./shell-for { inherit compiler-nix-name; };
203+ shell-for = callTest ./shell-for {};
203− cabal-22 = callTest ./cabal-22 { inherit util compiler-nix-name; };
204+ cabal-22 = callTest ./cabal-22 { inherit util; };
204− coverage = callTest ./coverage { inherit compiler-nix-name; };
205+ coverage = callTest ./coverage {};
205− coverage-golden = callTest ./coverage-golden { inherit compiler-nix-name;};
206+ coverage-golden = callTest ./coverage-golden { inherit;};
206− coverage-no-libs = callTest ./coverage-no-libs { inherit compiler-nix-name; };
207+ coverage-no-libs = callTest ./coverage-no-libs {};
207− snapshots = callTest ./snapshots { inherit compiler-nix-name; };
208+ snapshots = callTest ./snapshots {};
208− sublib-docs = callTest ./sublib-docs { inherit util compiler-nix-name; };
209+ sublib-docs = callTest ./sublib-docs { inherit util; };
209− githash = haskell-nix.callPackage ./githash { inherit compiler-nix-name; testSrc = testSrcWithGitDir; };
210+ githash = haskell-nix.callPackage ./githash { inherit compiler-nix-name evalPackages; testSrc = testSrcWithGitDir; };
210− c-ffi = callTest ./c-ffi { inherit util compiler-nix-name; };
211+ c-ffi = callTest ./c-ffi { inherit util; };
211− th-dlls = callTest ./th-dlls { inherit util compiler-nix-name; };
212+ th-dlls = callTest ./th-dlls { inherit util; };
212− external-static-plugin = callTest ./external-static-plugin { inherit compiler-nix-name; };
213+ external-static-plugin = callTest ./external-static-plugin {};
213− exe-dlls = callTest ./exe-dlls { inherit util compiler-nix-name; };
214+ exe-dlls = callTest ./exe-dlls { inherit util; };
214− exe-lib-dlls = callTest ./exe-lib-dlls { inherit util compiler-nix-name; };
215+ exe-lib-dlls = callTest ./exe-lib-dlls { inherit util; };
215− ca-derivations = callTest ./ca-derivations { inherit compiler-nix-name CADerivationsEnabled; };
216+ ca-derivations = callTest ./ca-derivations { inherit CADerivationsEnabled; };
216− ca-derivations-include = callTest ./ca-derivations-include { inherit compiler-nix-name CADerivationsEnabled; };
217+ ca-derivations-include = callTest ./ca-derivations-include { inherit CADerivationsEnabled; };
217
218
218 unit = unitTests;
219 unit = unitTests;
219 };
220 };
test/exe-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test building TH code that needs DLLs when cross compiling for windows
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = project' {
7 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "exe-dlls";
9 src = testSrc "exe-dlls";
10 };
10 };
11
11
test/exe-lib-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test building TH code that needs DLLs when cross compiling for windows
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = project' {
7 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "exe-lib-dlls";
9 src = testSrc "exe-lib-dlls";
10 };
10 };
11
11
test/exe-only/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = haskell-nix.cabalProject' {
7 project = haskell-nix.cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "exe-only";
9 src = testSrc "exe-only";
10 };
10 };
11
11
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
2 project = cabalProject' {
2 project = cabalProject' {
3 src = testSrc "external-static-plugin";
3 src = testSrc "external-static-plugin";
4− inherit compiler-nix-name;
4+ inherit compiler-nix-name evalPackages;
5 modules = [ {
5 modules = [ {
6 packages.prog.components.exes.prog.plugins = [ {
6 packages.prog.components.exes.prog.plugins = [ {
7 inherit (project.hsPkgs.plugin.components) library;
7 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 }:
2
2
3with lib;
3with lib;
4
4
@@ -13,7 +13,7 @@ let
13 demo-src = ./external-package-demo-0.1.0.0.tar.gz;
13 demo-src = ./external-package-demo-0.1.0.0.tar.gz;
14
14
15 project = cabalProject' {
15 project = cabalProject' {
16− inherit compiler-nix-name;
16+ inherit compiler-nix-name evalPackages;
17 src = testSrc "extra-hackage/external-package-user";
17 src = testSrc "extra-hackage/external-package-user";
18
18
19 extra-hackages = [ hackage ];
19 extra-hackages = [ hackage ];
test/fully-static/default.nix+5
@@ -3,6 +3,8 @@
3, buildPackages
3, buildPackages
4, recurseIntoAttrs
4, recurseIntoAttrs
5, testSrc
5, testSrc
6+, compiler-nix-name
7+, evalPackages
6}:
8}:
7
9
8with lib;
10with lib;
@@ -14,6 +16,7 @@ let
14
16
15 # IFD stack-to-nix
17 # IFD stack-to-nix
16 project = { gpl ? true }: stackProject' {
18 project = { gpl ? true }: stackProject' {
19+ inherit evalPackages;
17 src = testSrc "fully-static";
20 src = testSrc "fully-static";
18 pkg-def-extras = [];
21 pkg-def-extras = [];
19 modules = [
22 modules = [
@@ -28,6 +31,8 @@ let
28 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
31 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
29
32
30in recurseIntoAttrs {
33in recurseIntoAttrs {
34+ meta.disabled = stdenv.hostPlatform.isGhcjs || compiler-nix-name != "ghc865";
35+
31 ifdInputs = {
36 ifdInputs = {
32 stack-nix-gmp = (project { gpl = true; }).stack-nix;
37 stack-nix-gmp = (project { gpl = true; }).stack-nix;
33 stack-nix-simple = (project { gpl = false; }).stack-nix;
38 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "ghc-options";
8 src = testSrc "ghc-options";
9 # TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix
9 # TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix
10 modules = [ {
10 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = stackProject' {
6 project = stackProject' {
7+ inherit evalPackages;
7 src = testSrc "ghc-options";
8 src = testSrc "ghc-options";
8 };
9 };
9 packages = project.hsPkgs;
10 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7 src = testSrc "ghcjs-overlay";
7 src = testSrc "ghcjs-overlay";
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 cabalProjectLocal = lib.optionalString stdenv.hostPlatform.isGhcjs ''
9 cabalProjectLocal = lib.optionalString stdenv.hostPlatform.isGhcjs ''
10 repository ghcjs-overlay
10 repository ghcjs-overlay
11 url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/bfc363b9f879c360e0a0460ec0c18ec87222ec32
11 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 }:
2
2
3with lib;
3with lib;
4
4
@@ -34,7 +34,7 @@ let
34 }) ++ [{
34 }) ++ [{
35 packages.githash-test.components.exes.githash-test.build-tools = mkForce [ git ];
35 packages.githash-test.components.exes.githash-test.build-tools = mkForce [ git ];
36 }];
36 }];
37− inherit compiler-nix-name;
37+ inherit compiler-nix-name evalPackages;
38 };
38 };
39
39
40 packages = project.hsPkgs;
40 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 }:
2let
2let
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;
4in recurseIntoAttrs {
4in recurseIntoAttrs {
5 ifdInputs = {
5 ifdInputs = {
6 inherit (project) plan-nix;
6 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 }:
2let
2let
3 project = buildPackages.haskell-nix.project' {
3 project = buildPackages.haskell-nix.project' {
4− inherit compiler-nix-name;
4+ inherit compiler-nix-name evalPackages;
5− src = evalPackages.fetchgit {
5+ src = buildPackages.fetchgit {
6 url = "https://github.com/haskell/haskell-language-server.git";
6 url = "https://github.com/haskell/haskell-language-server.git";
7 fetchSubmodules = true;
7 fetchSubmodules = true;
8 rev = "32cd57df639d67ac0cf29882839e00532fd30c84";
8 rev = "32cd57df639d67ac0cf29882839e00532fd30c84";
test/index-state/default.nix+2−2
@@ -1,5 +1,5 @@
1# Test a package set
1# Test a package set
2−{ stdenv, lib, testSrc, tool, compiler-nix-name }:
2+{ stdenv, lib, testSrc, tool, compiler-nix-name, evalPackages }:
3
3
4with lib;
4with lib;
5
5
@@ -8,7 +8,7 @@ let
8 # See https://hackage.haskell.org/package/hackage-security-0.6.0.1
8 # See https://hackage.haskell.org/package/hackage-security-0.6.0.1
9 version-used-at = index-state: ((tool compiler-nix-name "cabal" {
9 version-used-at = index-state: ((tool compiler-nix-name "cabal" {
10 version = "3.2.0.0";
10 version = "3.2.0.0";
11− inherit index-state;
11+ inherit index-state evalPackages;
12 cabalProject = ''
12 cabalProject = ''
13 packages: .
13 packages: .
14 allow-newer: cabal-install:base, hackage-security:*
14 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "project-flags";
8 src = testSrc "project-flags";
9 };
9 };
10 packages = project.hsPkgs;
10 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = stackProject' {
6 project = stackProject' {
7 src = testSrc "project-flags";
7 src = testSrc "project-flags";
8+ inherit evalPackages;
8 };
9 };
9 packages = project.hsPkgs;
10 packages = project.hsPkgs;
10
11
test/setup-deps/default.nix+3−3
@@ -1,12 +1,12 @@
1−{ pkgs, compiler-nix-name }:
1+{ pkgs, compiler-nix-name, evalPackages }:
2
2
3with pkgs;
3with pkgs;
4with lib;
4with lib;
5
5
6let
6let
7 project = haskell-nix.cabalProject' {
7 project = haskell-nix.cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9− src = pkgs.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; };
9+ src = evalPackages.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; };
10 modules = [{
10 modules = [{
11 # Package has no exposed modules which causes
11 # Package has no exposed modules which causes
12 # haddock: No input file(s)
12 # 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 {
2 # The version of pandoc used in this test does not build with ghcjs or ghc 8.10
2 # The version of pandoc used in this test does not build with ghcjs or ghc 8.10
3 meta.disabled = stdenv.hostPlatform.isGhcjs
3 meta.disabled = stdenv.hostPlatform.isGhcjs
4 || builtins.compareVersions pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "8.10" >= 0;
4 || builtins.compareVersions pkgs.buildPackages.haskell-nix.compiler.${compiler-nix-name}.version "8.10" >= 0;
@@ -6,7 +6,7 @@
6 # A dependency is broken on windows, just run this on unix.
6 # A dependency is broken on windows, just run this on unix.
7 platforms = lib.platforms.unix;
7 platforms = lib.platforms.unix;
8 } ((haskell-nix.hackage-package {
8 } ((haskell-nix.hackage-package {
9− inherit compiler-nix-name;
9+ inherit compiler-nix-name evalPackages;
10 name = "pandoc";
10 name = "pandoc";
11 version = "2.9.2.1";
11 version = "2.9.2.1";
12 # Function that returns a sha256 string by looking up the location
12 # 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 }:
2
2
3with lib;
3with lib;
4
4
5let
5let
6 project = cabalProject' {
6 project = cabalProject' {
7− inherit compiler-nix-name;
7+ inherit compiler-nix-name evalPackages;
8 src = testSrc "shell-for-setup-deps";
8 src = testSrc "shell-for-setup-deps";
9 modules = [{
9 modules = [{
10 # Package has no exposed modules which causes
10 # 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 }:
2
2
3with lib;
3with lib;
4
4
@@ -13,6 +13,7 @@ let
13 # Package has no exposed modules which causes
13 # Package has no exposed modules which causes
14 # haddock: No input file(s)
14 # haddock: No input file(s)
15 packages.bytestring-builder.doHaddock = false;
15 packages.bytestring-builder.doHaddock = false;
16+ inherit evalPackages;
16 }];
17 }];
17 };
18 };
18
19
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 }:
2
2
3with lib;
3with lib;
4
4
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 }:
2
2
3let
3let
4 project = project' {
4 project = project' {
5 src = testSrc "stack-local-resolver-subdir";
5 src = testSrc "stack-local-resolver-subdir";
6+ inherit evalPackages;
6 };
7 };
7 packages = project.hsPkgs;
8 packages = project.hsPkgs;
8
9
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 }:
2
2
3let
3let
4 project = project' {
4 project = project' {
5 src = testSrc "stack-local-resolver";
5 src = testSrc "stack-local-resolver";
6+ inherit evalPackages;
6 };
7 };
7 packages = project.hsPkgs;
8 packages = project.hsPkgs;
8
9
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 }:
2
2
3let
3let
4 project = project' {
4 project = project' {
5 src = testSrc "stack-remote-resolver";
5 src = testSrc "stack-remote-resolver";
6 resolverSha256 = "1rldkqqsxd8zxybrkqhc25bcxinhz212kz45jcz8jinfihc91jl7";
6 resolverSha256 = "1rldkqqsxd8zxybrkqhc25bcxinhz212kz45jcz8jinfihc91jl7";
7+ inherit evalPackages;
7 };
8 };
8 packages = project.hsPkgs;
9 packages = project.hsPkgs;
9
10
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 }:
2
2
3with lib;
3with lib;
4
4
@@ -8,7 +8,7 @@ let
8 pkgSet = mkStackPkgSet {
8 pkgSet = mkStackPkgSet {
9 stack-pkgs = import ./pkgs.nix;
9 stack-pkgs = import ./pkgs.nix;
10 pkg-def-extras = [];
10 pkg-def-extras = [];
11− modules = [];
11+ modules = [{inherit evalPackages;}];
12 };
12 };
13
13
14 packages = pkgSet.config.hsPkgs;
14 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 }:
2
2
3let
3let
4 project = stackProject' {
4 project = stackProject' {
5 src = testSrc "stack-source-repo";
5 src = testSrc "stack-source-repo";
6+ inherit evalPackages;
6 };
7 };
7 packages = project.hsPkgs;
8 packages = project.hsPkgs;
8
9
test/sublib-docs/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test a package set
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = cabalProject' {
7 project = cabalProject' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "sublib-docs";
9 src = testSrc "sublib-docs";
10 cabalProject = ''
10 cabalProject = ''
11 packages: .
11 packages: .
test/th-dlls/default.nix+2−2
@@ -1,11 +1,11 @@
1# Test building TH code that needs DLLs when cross compiling for windows
1# 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 }:
3
3
4with lib;
4with lib;
5
5
6let
6let
7 project = project' {
7 project = project' {
8− inherit compiler-nix-name;
8+ inherit compiler-nix-name evalPackages;
9 src = testSrc "th-dlls";
9 src = testSrc "th-dlls";
10 };
10 };
11
11
test/unit.nix+4−4
@@ -1,4 +1,4 @@
1−{ pkgs, lib, haskellLib, compiler-nix-name }:
1+{ pkgs, evalPackages, lib, haskellLib, compiler-nix-name }:
2
2
3let
3let
4 emptyConfig = {
4 emptyConfig = {
@@ -119,9 +119,9 @@ lib.runTests {
119 };
119 };
120
120
121 testParseRepositoryBlock = {
121 testParseRepositoryBlock = {
122− expr = __toJSON (haskellLib.parseRepositoryBlock "cabal.project" {} {}
122+ expr = __toJSON (haskellLib.parseRepositoryBlock evalPackages "cabal.project" {} {}
123− pkgs.evalPackages.haskell-nix.cabal-install.${compiler-nix-name}
123+ evalPackages.haskell-nix.cabal-install.${compiler-nix-name}
124− pkgs.evalPackages.haskell-nix.nix-tools.${compiler-nix-name} ''
124+ evalPackages.haskell-nix.nix-tools.${compiler-nix-name} ''
125 ghcjs-overlay
125 ghcjs-overlay
126 url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/bfc363b9f879c360e0a0460ec0c18ec87222ec32
126 url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/bfc363b9f879c360e0a0460ec0c18ec87222ec32
127 secure: True
127 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 }:
2
2
3with lib;
3with lib;
4with util;
4with util;
@@ -21,6 +21,8 @@ let
21 {
21 {
22 packages.test-with-packages.components.library.doExactConfig = doExactConfig;
22 packages.test-with-packages.components.library.doExactConfig = doExactConfig;
23 }
23 }
24+
25+ { inherit evalPackages; }
24 ];
26 ];
25 };
27 };
26
28