on iko/ghcjs-patch-master help sign in
Run the cross compiled tests on wine (#317)

Changes to the haskell.nix code to fix broken tests: * Add missing `then` to `call-cabal-project-to-nix.nix`. * Fix default `hsSourceDirs` so that `.` gets included for `.all` component if one of the components does not have a `hsSourceDir` set. * Fix `haskellNixRoots` so it works when cross compiling to windows. Improvements to the haskell.nix tests: * Run haskell.nix tests of nixpkgs 19.03 and 19.09. * Run haskell.nix tests cross compiled to Windows under Wine (when possible). * Add nix used as IFD inputs as tests to ensure they are cached. * Use `haskell-nix.cabal-install` instead of `nixpkgs.cabal-install` in tests.

commit79c2c631c3938093e7a7704bee3c7e094ee198e1 authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateWed 20 Nov 2019, 13:47 (7 years ago) parentd8ab386
41 files changed+399−1106
build.nix+7−4 lib/call-cabal-project-to-nix.nix+1−1 modules/package.nix+1−1 nixpkgs/github.json+3−3 nixpkgs/release-19.03.json+4−4 nixpkgs/release-19.09.json+7 overlays/haskell.nix+10−7 release.nix+41−17 test/buildable/default.nix+12−15 test/builder-haddock/default.nix+6−1 test/cabal-22/.plan.nix/project.nix−94 test/cabal-22/default.nix+12−9 test/cabal-22/pkgs.nix−74 test/cabal-22/project.nix−93 test/cabal-simple-prof/.plan.nix/cabal-simple.nix−32 test/cabal-simple-prof/default.nix+24−19 test/cabal-simple-prof/pkgs.nix−124 test/cabal-simple/.plan.nix/cabal-simple.nix−79 test/cabal-simple/default.nix+22−16 test/cabal-simple/pkgs.nix−124 test/cabal-source-repo/default.nix+13−14 test/cabal-sublib/.plan.nix/cabal-sublib.nix−87 test/cabal-sublib/default.nix+22−16 test/cabal-sublib/pkgs.nix−124 test/call-cabal-project-to-nix/default.nix+18−12 test/call-stack-to-nix/default.nix+13−9 test/default.nix+1−1 test/exe-only/default.nix+5−3 test/fully-static/default.nix+19−16 test/fully-static/stack.yaml+1−1 test/ghc-options/cabal.nix+14−17 test/ghc-options/stack.nix+11−14 test/ghc-options/stack.yaml+1−1 test/project-flags/cabal.nix+14−14 test/project-flags/stack.nix+11−11 test/project-flags/stack.yaml+1−1 test/setup-deps/default.nix+17−6 test/shell-for-setup-deps/default.nix+22−12 test/shell-for/default.nix+19−5 test/snapshots/default.nix+23−6 test/with-packages/default.nix+24−19
build.nix+7−4
@@ -21,6 +21,7 @@ let
2121 name = "darcs";
2222 version = "2.14.2";
2323 index-state = "2019-10-28T00:00:00Z";
24+ plan-sha256 = "1h8dxib0wz6mg8md6ldwa54dsr1dn7vxfij8cfhdawl4y3wr51k0";
2425 # Apply the latest darcs.net Setup.hs patches
2526 modules = [{packages.darcs.patches = [ ./patches/darcs-setup.patch ];}];
2627 }).components.exes.darcs;
@@ -38,7 +39,7 @@ in rec {
3839 update-hackage = haskell.callPackage ./scripts/update-hackage.nix {};
3940 update-stackage = haskell.callPackage ./scripts/update-stackage.nix {};
4041 update-pins = haskell.callPackage ./scripts/update-pins.nix {};
41− update-docs = haskell.callPackage ./scripts/update-docs.nix {
42+ update-docs = pkgs.buildPackages.callPackage ./scripts/update-docs.nix {
4243 generatedOptions = import ./scripts/options-doc.nix {
4344 # nixpkgs unstable changes "Option has no description" from an
4445 # error into a warning. That is quite helpful when hardly any
@@ -51,8 +52,10 @@ in rec {
5152 }) {};
5253 };
5354 };
54− check-hydra = haskell.callPackage ./scripts/check-hydra.nix {};
55− check-closure-size = haskell.callPackage ./scripts/check-closure-size.nix {};
55+ check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
56+ check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
57+ inherit (haskell) nix-tools;
58+ };
5659 };
5760
5861 # These are pure parts of maintainer-script so they can be built by hydra
@@ -61,7 +64,7 @@ in rec {
6164 inherit (maintainer-scripts) update-docs check-hydra check-closure-size;
6265 # Some of the dependencies of the impure scripts so that they will
6366 # will be in the cache too for buildkite.
64− inherit (pkgs) coreutils glibc git openssh cabal-install nix-prefetch-git;
67+ inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
6568 inherit (haskell) nix-tools;
6669 };
6770}
lib/call-cabal-project-to-nix.nix+1−1
@@ -174,7 +174,7 @@ let
174174 # project where the files haven't been added to the git
175175 # repo yet. We fail early and provide a useful error
176176 # message to prevent headaches (#290).
177− if [ -z "$(ls -A ${maybeCleanedSource})" ];
177+ if [ -z "$(ls -A ${maybeCleanedSource})" ]; then
178178 echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
179179 fi
180180 cp -r ${maybeCleanedSource}/* .
modules/package.nix+1−1
@@ -192,7 +192,7 @@ in {
192192 };
193193 hsSourceDirs = mkOption {
194194 type = listOfFilteringNulls unspecified;
195− default = [];
195+ default = ["."];
196196 };
197197 includeDirs = mkOption {
198198 type = listOfFilteringNulls unspecified;
nixpkgs/github.json+3−3
@@ -1,7 +1,7 @@
11{
22 "url": "https://github.com/input-output-hk/nixpkgs",
3− "rev": "3d623a406cec9052ae0a16a79ce3ce9de11236bb",
4− "date": "2019-10-18T17:51:24+13:00",
5− "sha256": "1a4yd980ylh1ygvmws15wldifz7jxjy8z07vc914kam1p25yjpj1",
3+ "rev": "31aa5316ca232a53667790a99e8b1e76252e065c",
4+ "date": "2019-11-16T23:51:02+13:00",
5+ "sha256": "0g0r473rdrh5vsdvr45nmfs6ibp0pqyzbw9f0iv6r0jkg6jjiykr",
66 "fetchSubmodules": false
77}
nixpkgs/release-19.03.json+4−4
@@ -1,7 +1,7 @@
11{
2− "url": "https://github.com/nixos/nixpkgs",
3− "rev": "49ac77d07eb9757244b776e35b9eb68d63943b12",
4− "date": "2019-07-30T15:46:41+02:00",
5− "sha256": "0xsmh17z5bl17dnpwf23m53a432651ylvk8qnjlmj43blxgiwrs5",
2+ "url": "https://github.com/input-output-hk/nixpkgs",
3+ "rev": "a8f81dc037a5977414a356dd068f2621b3c89b60",
4+ "date": "2019-10-17T21:54:56+08:00",
5+ "sha256": "01z13axll5g5yl00lz9adr2jw2bs12g9skhbb1vxy8p7fjjbhhhm",
66 "fetchSubmodules": false
77}
nixpkgs/release-19.09.jsonnew file+7
@@ -0,0 +1,7 @@
1+{
2+ "url": "https://github.com/input-output-hk/nixpkgs",
3+ "rev": "31aa5316ca232a53667790a99e8b1e76252e065c",
4+ "date": "2019-11-16T23:51:02+13:00",
5+ "sha256": "0g0r473rdrh5vsdvr45nmfs6ibp0pqyzbw9f0iv6r0jkg6jjiykr",
6+ "fetchSubmodules": false
7+}
overlays/haskell.nix+10−7
@@ -365,20 +365,23 @@ self: super: {
365365 inherit derivation;
366366 inputs = builtins.listToAttrs (
367367 builtins.concatMap (i: if i == null then [] else [
368− { name = builtins.replaceStrings ["."] ["_"] i.name; value = i; }
368+ { name = builtins.replaceStrings ["." (self.stdenv.hostPlatform.config + "-")] ["_" ""] i.name; value = i; }
369369 ]) derivation.nativeBuildInputs);
370370 };
371371
372372 # Add this to your tests to make all the dependencies of haskell.nix
373373 # are tested and cached.
374374 haskellNixRoots = self.recurseIntoAttrs (builtins.mapAttrs (_: self.recurseIntoAttrs) {
375− inherit (self.haskell-nix) nix-tools source-pins;
376− bootstap-nix-tools = self.haskell-nix.bootstrap.packages.nix-tools;
377− alex-plan-nix = withInputs self.haskell-nix.bootstrap.packages.alex-project.plan-nix;
378− happy-plan-nix = withInputs self.haskell-nix.bootstrap.packages.happy-project.plan-nix;
379− hscolour-plan-nix = withInputs self.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
375+ inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
376+ bootstap-nix-tools = self.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
377+ alex-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
378+ happy-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
379+ hscolour-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
380380 ghc-extra-projects = builtins.mapAttrs (_: proj: self.recurseIntoAttrs (withInputs proj.plan-nix))
381− (self.lib.filterAttrs (n: _: n != "ghc844" && n != "ghc861" && n != "ghc862") self.ghc-extra-projects);
381+ (self.lib.filterAttrs (n: _: n != "ghc844" && n != "ghc861" && n != "ghc862"
382+ # There is an issue with GHC 8.6.4 and nixpkgs 19.09, so only build it for 19.03 for now
383+ && (n != "ghc864" || super.lib.versions.majorMinor super.lib.version == "19.03")
384+ ) self.ghc-extra-projects);
382385 });
383386 };
384387}
release.nix+41−17
@@ -4,13 +4,8 @@
44, nixpkgsArgs ? {}
55}:
66
7−let fixedNixpkgs = import ./nixpkgs {}; in
8−with fixedNixpkgs.lib;
9−with (import (fixedNixpkgs.path + "/pkgs/top-level/release-lib.nix") {
10− inherit supportedSystems scrubJobs nixpkgsArgs;
11− packageSet = import (haskell-nix + /build.nix);
12−});
13−
7+let defaultNixpkgs = import ./nixpkgs {}; in
8+with defaultNixpkgs.lib;
149let
1510 # Remove tests which have meta.disabled = true
1611 filterTests = let
@@ -20,20 +15,49 @@ let
2015 tests = filterAttrs (_: nonEmpty) (mapAttrs (name: removeDisabled) jobs.tests);
2116 };
2217
23− inherit (systems.examples) musl64;
18+ jobs = nixpkgs-pin:
19+ # Now we know what nixpkgs-pin we are testing use that one.
20+ # This fixes and issue where the vendor has changed from `x86_64-pc-mingw32`
21+ # to `x86_64-w64-mingw32` in 19.09.
22+ let pinnedNixpkgs = import ./nixpkgs { inherit nixpkgs-pin; }; in
23+ with pinnedNixpkgs.lib;
24+ let inherit (systems.examples) musl64 mingwW64; in
25+ with (import (pinnedNixpkgs.path + "/pkgs/top-level/release-lib.nix") {
26+ inherit supportedSystems scrubJobs nixpkgsArgs;
27+ packageSet = {
28+ system ? builtins.currentSystem
29+ , crossSystem ? null
30+ , nixpkgsArgs ? { inherit system crossSystem; }
31+ , ...}@args:
32+ import (haskell-nix + /build.nix) (args // {
33+ nixpkgsArgs = nixpkgsArgs // { inherit nixpkgs-pin; };
34+ });
35+ });
36+
37+ {
38+ native = filterTests (mapTestOn (packagePlatforms pkgs));
39+ # Disabled for now. Something is wrong and this would require `allowBroken`
40+ # "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
41+ } // (optionalAttrs (nixpkgs-pin == "release-19.03") {
42+ "${mingwW64.config}" = filterTests (mapTestOnCross mingwW64 (packagePlatforms pkgs));
43+ });
44+
45+ allJobs =
46+ builtins.mapAttrs (_: nixpkgs-pin: jobs nixpkgs-pin) {
47+ "R1903" = "release-19.03";
48+ "R1909" = "release-19.09";
49+ };
2450
25− jobs = {
26− native = filterTests (mapTestOn (packagePlatforms pkgs));
27− # Disabled for now. Something is wrong and this would require `allowBroken`
28− # "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
29− } // {
51+in allJobs // {
3052 # On IOHK Hydra, "required" is a special job that updates the
3153 # GitHub CI status.
32− required = fixedNixpkgs.releaseTools.aggregate {
54+ required = defaultNixpkgs.releaseTools.aggregate {
3355 name = "haskell.nix-required";
3456 meta.description = "All jobs required to pass CI";
35− constituents = collect isDerivation jobs.native;
57+ constituents =
58+ collect isDerivation allJobs.R1903.native
59+ ++ collect isDerivation allJobs.R1909.native;
3660 };
37− };
61+ }
62+
3863
39−in jobs
test/buildable/default.nix+12−15
@@ -1,28 +1,25 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, cabalProject', haskellLib, recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− plan = importAndFilterProject (callCabalProjectToNix {
6+ project = cabalProject' {
77 name = "test-buildable";
88 index-state = "2019-04-30T00:00:00Z";
9− src = ./.;
10− });
11− pkgSet = mkCabalProjectPkgSet {
12− plan-pkgs = plan.pkgs;
9+ src = haskellLib.cleanGit { src = ../..; subDir = "test/buildable"; };
1310 modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
1411 };
15− packages = pkgSet.config.hsPkgs;
16−in
17− stdenv.mkDerivation {
12+ packages = project.hsPkgs;
13+
14+in recurseIntoAttrs {
15+ inherit (project) plan-nix;
16+ run = stdenv.mkDerivation {
1817 name = "buildable-test";
1918
2019 buildCommand =
2120 (concatStrings (mapAttrsToList (name: value: ''
22− exe="${value}/bin/${name}"
23−
2421 printf "checking whether executable runs... " >& 2
25− $exe
22+ cat ${value.run}
2623 '') packages.buildable-test.components.exes)) + ''
2724 touch $out
2825 '';
@@ -31,7 +28,7 @@ in
3128
3229 passthru = {
3330 # Attributes used for debugging with nix repl
34− inherit pkgSet packages;
35− inherit (plan) nix;
31+ inherit project packages;
3632 };
37− }
33+ };
34+}
test/builder-haddock/default.nix+6−1
@@ -35,7 +35,12 @@ in
3535 buildCommand = let
3636 inherit (packages.test-haddock.components) library;
3737 noDocLibrary = packages.stm.components.library;
38− in ''
38+ in if (stdenv.hostPlatform != stdenv.buildPlatform)
39+ then ''
40+ echo "Skipping haddock tests when cross compiling" >& 2
41+ touch $out
42+ ''
43+ else ''
3944 ########################################################################
4045 # test haddock
4146
test/cabal-22/.plan.nix/project.nixdeleted−94
@@ -1,94 +0,0 @@
1−let
2− buildDepError = pkg:
3− builtins.throw ''
4− The Haskell package set does not contain the package: ${pkg} (build dependency).
5−
6− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7− '';
8− sysDepError = pkg:
9− builtins.throw ''
10− The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11−
12− You may need to augment the system package mapping in haskell.nix so that it can be found.
13− '';
14− pkgConfDepError = pkg:
15− builtins.throw ''
16− The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17−
18− You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19− '';
20− exeDepError = pkg:
21− builtins.throw ''
22− The local executable components do not include the component: ${pkg} (executable dependency).
23− '';
24− legacyExeDepError = pkg:
25− builtins.throw ''
26− The Haskell package set does not contain the package: ${pkg} (executable dependency).
27−
28− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29− '';
30− buildToolDepError = pkg:
31− builtins.throw ''
32− Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33−
34− If this is a system dependency:
35− You may need to augment the system package mapping in haskell.nix so that it can be found.
36−
37− If this is a Haskell dependency:
38− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39− '';
40−in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41− {
42− flags = {};
43− package = {
44− specVersion = "2.2";
45− identifier = { name = "project"; version = "0.1.0.0"; };
46− license = "NONE";
47− copyright = "";
48− maintainer = "rodney.lorrimar@iohk.io";
49− author = "Rodney Lorrimar";
50− homepage = "";
51− url = "";
52− synopsis = "";
53− description = "";
54− buildType = "Simple";
55− isLocal = true;
56− };
57− components = {
58− "library" = {
59− depends = [ (hsPkgs."base" or (buildDepError "base")) ];
60− buildable = true;
61− };
62− exes = {
63− "project" = {
64− depends = [
65− (hsPkgs."base" or (buildDepError "base"))
66− (hsPkgs."project" or (buildDepError "project"))
67− ];
68− buildable = true;
69− };
70− };
71− tests = {
72− "unit" = {
73− depends = [
74− (hsPkgs."base" or (buildDepError "base"))
75− (hsPkgs."project" or (buildDepError "project"))
76− (hsPkgs."hspec" or (buildDepError "hspec"))
77− ];
78− build-tools = [
79− (hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (buildToolDepError "hspec-discover")))
80− ];
81− buildable = true;
82− };
83− };
84− benchmarks = {
85− "project-bench" = {
86− depends = [
87− (hsPkgs."base" or (buildDepError "base"))
88− (hsPkgs."project" or (buildDepError "project"))
89− ];
90− buildable = true;
91− };
92− };
93− };
94− } // rec { src = (pkgs.lib).mkDefault ../.; }
test/cabal-22/default.nix+12−9
@@ -1,20 +1,23 @@
1−{ stdenv, mkCabalProjectPkgSet, util }:
1+{ stdenv, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− pkgSet = mkCabalProjectPkgSet {
7− plan-pkgs = import ./pkgs.nix;
6+ project = cabalProject' {
7+ name = "cabal-22";
8+ src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-22"; };
89 };
910
10− packages = pkgSet.config.hsPkgs;
11+ packages = project.hsPkgs;
1112
12−in
13− stdenv.mkDerivation {
13+in recurseIntoAttrs {
14+ inherit (project) plan-nix;
15+ shell = util.addCabalInstall packages.project.components.all;
16+ run = stdenv.mkDerivation {
1417 name = "cabal-22-test";
1518
1619 buildCommand = ''
17− exe="${packages.project.components.exes.project}/bin/project"
20+ exe="${packages.project.components.exes.project}/bin/project${stdenv.hostPlatform.extensions.executable}"
1821
1922 size=$(command stat --format '%s' "$exe")
2023 printf "size of executable $exe is $size. \n" >& 2
@@ -56,6 +59,6 @@ in
5659 meta.platforms = platforms.all;
5760 passthru = {
5861 inherit (packages) project;
59− shell = util.addCabalInstall packages.project.components.all;
6062 };
61− }
63+ };
64+}
test/cabal-22/pkgs.nixdeleted−74
@@ -1,74 +0,0 @@
1−{
2− pkgs = hackage:
3− {
4− packages = {
5− "tf-random".revision = (((hackage."tf-random")."0.5").revisions).default;
6− "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
7− "stm".revision = (((hackage."stm")."2.5.0.0").revisions).default;
8− "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
9− "rts".revision = (((hackage."rts")."1.0").revisions).default;
10− "clock".revision = (((hackage."clock")."0.8").revisions).default;
11− "clock".flags.llvm = false;
12− "QuickCheck".revision = (((hackage."QuickCheck")."2.13.2").revisions).default;
13− "QuickCheck".flags.templatehaskell = true;
14− "hspec-discover".revision = (((hackage."hspec-discover")."2.7.1").revisions).default;
15− "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
16− "random".revision = (((hackage."random")."1.1").revisions).default;
17− "splitmix".revision = (((hackage."splitmix")."0.0.3").revisions).default;
18− "splitmix".flags.optimised-mixer = false;
19− "splitmix".flags.random = true;
20− "HUnit".revision = (((hackage."HUnit")."1.6.0.0").revisions).default;
21− "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
22− "template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
23− "hspec-expectations".revision = (((hackage."hspec-expectations")."0.8.2").revisions).default;
24− "call-stack".revision = (((hackage."call-stack")."0.2.0").revisions).default;
25− "primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
26− "ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
27− "ansi-terminal".flags.example = false;
28− "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
29− "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
30− "setenv".revision = (((hackage."setenv")."0.1.1.3").revisions).default;
31− "base".revision = (((hackage."base")."4.12.0.0").revisions).default;
32− "hspec".revision = (((hackage."hspec")."2.7.1").revisions).default;
33− "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
34− "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
35− "quickcheck-io".revision = (((hackage."quickcheck-io")."0.2.0").revisions).default;
36− "colour".revision = (((hackage."colour")."2.3.5").revisions).default;
37− "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
38− "hspec-core".revision = (((hackage."hspec-core")."2.7.1").revisions).default;
39− "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
40− "ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
41− "array".revision = (((hackage."array")."0.5.3.0").revisions).default;
42− "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
43− };
44− compiler = {
45− version = "8.6.5";
46− nix-name = "ghc865";
47− packages = {
48− "ghc-prim" = "0.5.3";
49− "stm" = "2.5.0.0";
50− "unix" = "2.7.2.2";
51− "rts" = "1.0";
52− "deepseq" = "1.4.4.0";
53− "directory" = "1.3.3.0";
54− "template-haskell" = "2.14.0.0";
55− "containers" = "0.6.0.1";
56− "bytestring" = "0.10.8.2";
57− "base" = "4.12.0.0";
58− "time" = "1.8.0.2";
59− "transformers" = "0.5.6.2";
60− "filepath" = "1.4.2.1";
61− "pretty" = "1.1.3.6";
62− "ghc-boot-th" = "8.6.5";
63− "array" = "0.5.3.0";
64− "integer-gmp" = "1.0.2.0";
65− };
66− };
67− };
68− extras = hackage:
69− { packages = { project = ./.plan.nix/project.nix; }; };
70− modules = [
71− ({ lib, ... }:
72− { packages = { "project" = { flags = {}; }; }; })
73− ];
74− }
test/cabal-22/project.nixdeleted−93
@@ -1,93 +0,0 @@
1−let
2− buildDepError = pkg:
3− builtins.throw ''
4− The Haskell package set does not contain the package: ${pkg} (build dependency).
5−
6− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7− '';
8− sysDepError = pkg:
9− builtins.throw ''
10− The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11−
12− You may need to augment the system package mapping in haskell.nix so that it can be found.
13− '';
14− pkgConfDepError = pkg:
15− builtins.throw ''
16− The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17−
18− You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19− '';
20− exeDepError = pkg:
21− builtins.throw ''
22− The local executable components do not include the component: ${pkg} (executable dependency).
23− '';
24− legacyExeDepError = pkg:
25− builtins.throw ''
26− The Haskell package set does not contain the package: ${pkg} (executable dependency).
27−
28− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29− '';
30− buildToolDepError = pkg:
31− builtins.throw ''
32− Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33−
34− If this is a system dependency:
35− You may need to augment the system package mapping in haskell.nix so that it can be found.
36−
37− If this is a Haskell dependency:
38− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39− '';
40−in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41− {
42− flags = {};
43− package = {
44− specVersion = "2.2";
45− identifier = { name = "project"; version = "0.1.0.0"; };
46− license = "NONE";
47− copyright = "";
48− maintainer = "rodney.lorrimar@iohk.io";
49− author = "Rodney Lorrimar";
50− homepage = "";
51− url = "";
52− synopsis = "";
53− description = "";
54− buildType = "Simple";
55− };
56− components = {
57− "library" = {
58− depends = [ (hsPkgs."base" or (buildDepError "base")) ];
59− buildable = true;
60− };
61− exes = {
62− "project" = {
63− depends = [
64− (hsPkgs."base" or (buildDepError "base"))
65− (hsPkgs."project" or (buildDepError "project"))
66− ];
67− buildable = true;
68− };
69− };
70− tests = {
71− "unit" = {
72− depends = [
73− (hsPkgs."base" or (buildDepError "base"))
74− (hsPkgs."project" or (buildDepError "project"))
75− (hsPkgs."hspec" or (buildDepError "hspec"))
76− ];
77− build-tools = [
78− (hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (buildToolDepError "hspec-discover")))
79− ];
80− buildable = true;
81− };
82− };
83− benchmarks = {
84− "project-bench" = {
85− depends = [
86− (hsPkgs."base" or (buildDepError "base"))
87− (hsPkgs."project" or (buildDepError "project"))
88− ];
89− buildable = true;
90− };
91− };
92− };
93− } // rec { src = (pkgs.lib).mkDefault ./.; }
test/cabal-simple-prof/.plan.nix/cabal-simple.nixdeleted−32
@@ -1,32 +0,0 @@
1−{ system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
2− {
3− flags = {};
4− package = {
5− specVersion = "1.10";
6− identifier = { name = "cabal-simple"; version = "0.1.0.0"; };
7− license = "LicenseRef-PublicDomain";
8− copyright = "";
9− maintainer = "rodney.lorrimar@iohk.io";
10− author = "Rodney Lorrimar";
11− homepage = "";
12− url = "";
13− synopsis = "";
14− description = "";
15− buildType = "Simple";
16− };
17− components = {
18− "library" = {
19− depends = [ (hsPkgs.base) (hsPkgs.extra) (hsPkgs.safe) (hsPkgs.aeson) ];
20− };
21− exes = {
22− "cabal-simple" = {
23− depends = [
24− (hsPkgs.base)
25− (hsPkgs.cabal-simple)
26− (hsPkgs.extra)
27− (hsPkgs.optparse-applicative)
28− ];
29− };
30− };
31− };
32− } // rec { src = (pkgs.lib).mkDefault ../.; }
test/cabal-simple-prof/default.nix+24−19
@@ -1,38 +1,42 @@
11# Test a package set
2−{ stdenv, util, mkCabalProjectPkgSet }:
2+{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs }:
33
44with stdenv.lib;
55
66let
7− pkgSet = mkCabalProjectPkgSet {
8− plan-pkgs = import ./pkgs.nix;
9− modules = [
10− {
11− # Package has no exposed modules which causes
12− # haddock: No input file(s)
13− packages.cabal-simple.doHaddock = false;
14− packages.cabal-simple.enableExecutableProfiling = true;
15− enableLibraryProfiling = true;
16− # executableProfiling = false;
17− }
18− ];
7+ modules = [
8+ {
9+ # Package has no exposed modules which causes
10+ # haddock: No input file(s)
11+ packages.cabal-simple.doHaddock = false;
12+ packages.cabal-simple.enableExecutableProfiling = true;
13+ enableLibraryProfiling = true;
14+ # executableProfiling = false;
15+ }
16+ ];
17+
18+ project = cabalProject' {
19+ name = "cabal-simple-prof";
20+ src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-simple-prof"; };
21+ inherit modules;
1922 };
2023
21− packages = pkgSet.config.hsPkgs;
24+ packages = project.hsPkgs;
2225
23−in
24− stdenv.mkDerivation {
26+in recurseIntoAttrs {
27+ inherit (project) plan-nix;
28+ run = stdenv.mkDerivation {
2529 name = "cabal-simple-prof-test";
2630
2731 buildCommand = ''
28− exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
32+ exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
2933
3034 size=$(command stat --format '%s' "$exe")
3135 printf "size of executable $exe is $size. \n" >& 2
3236
3337 # fixme: run on target platform when cross-compiled
3438 printf "checking whether executable runs with profiling... " >& 2
35− $exe +RTS -p -h
39+ ${toString packages.cabal-simple.components.exes.cabal-simple.config.testWrapper} $exe +RTS -p -h
3640
3741 touch $out
3842 '';
@@ -41,10 +45,11 @@ in
4145
4246 passthru = {
4347 # Used for debugging with nix repl
44− inherit pkgSet packages;
48+ inherit project packages;
4549
4650 # Used for testing externally with nix-shell (../tests.sh).
4751 # This just adds cabal-install to the existing shells.
4852 test-shell = util.addCabalInstall packages.cabal-simple.components.all;
4953 };
54+ };
5055}
test/cabal-simple-prof/pkgs.nixdeleted−124
@@ -1,124 +0,0 @@
1−{
2− pkgs = hackage:
3− {
4− packages = {
5− "binary".revision = (((hackage."binary")."0.8.5.1").revisions).default;
6− "ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default;
7− "extra".revision = (((hackage."extra")."1.6.15").revisions).default;
8− "stm".revision = (((hackage."stm")."2.4.5.1").revisions).default;
9− "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
10− "rts".revision = (((hackage."rts")."1.0").revisions).default;
11− "clock".revision = (((hackage."clock")."0.8").revisions).default;
12− "clock".flags.llvm = false;
13− "scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
14− "scientific".flags.integer-simple = false;
15− "scientific".flags.bytestring-builder = false;
16− "deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default;
17− "random".revision = (((hackage."random")."1.1").revisions).default;
18− "uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
19− "optparse-applicative".revision = (((hackage."optparse-applicative")."0.14.3.0").revisions).default;
20− "dlist".revision = (((hackage."dlist")."0.8.0.6").revisions).default;
21− "semigroups".revision = (((hackage."semigroups")."0.19").revisions).default;
22− "semigroups".flags.bytestring = true;
23− "semigroups".flags.unordered-containers = true;
24− "semigroups".flags.text = true;
25− "semigroups".flags.tagged = true;
26− "semigroups".flags.containers = true;
27− "semigroups".flags.binary = true;
28− "semigroups".flags.hashable = true;
29− "semigroups".flags.transformers = true;
30− "semigroups".flags.deepseq = true;
31− "semigroups".flags.bytestring-builder = false;
32− "semigroups".flags.template-haskell = true;
33− "directory".revision = (((hackage."directory")."1.3.1.5").revisions).default;
34− "transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
35− "transformers-compat".flags.five = false;
36− "transformers-compat".flags.generic-deriving = true;
37− "transformers-compat".flags.two = false;
38− "transformers-compat".flags.five-three = true;
39− "transformers-compat".flags.mtl = true;
40− "transformers-compat".flags.four = false;
41− "transformers-compat".flags.three = false;
42− "template-haskell".revision = (((hackage."template-haskell")."2.13.0.0").revisions).default;
43− "vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
44− "vector".flags.unsafechecks = false;
45− "vector".flags.internalchecks = false;
46− "vector".flags.wall = false;
47− "vector".flags.boundschecks = true;
48− "primitive".revision = (((hackage."primitive")."0.6.4.0").revisions).default;
49− "time-locale-compat".revision = (((hackage."time-locale-compat")."0.1.1.5").revisions).default;
50− "time-locale-compat".flags.old-locale = false;
51− "safe".revision = (((hackage."safe")."0.3.17").revisions).default;
52− "base-compat".revision = (((hackage."base-compat")."0.10.5").revisions).default;
53− "ansi-terminal".revision = (((hackage."ansi-terminal")."0.9.1").revisions).default;
54− "ansi-terminal".flags.example = false;
55− "tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
56− "tagged".flags.transformers = true;
57− "tagged".flags.deepseq = true;
58− "containers".revision = (((hackage."containers")."0.5.11.0").revisions).default;
59− "integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
60− "integer-logarithms".flags.check-bounds = false;
61− "integer-logarithms".flags.integer-gmp = true;
62− "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
63− "ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
64− "ansi-wl-pprint".flags.example = false;
65− "StateVar".revision = (((hackage."StateVar")."1.1.1.1").revisions).default;
66− "contravariant".revision = (((hackage."contravariant")."1.5.1").revisions).default;
67− "contravariant".flags.semigroups = true;
68− "contravariant".flags.tagged = true;
69− "contravariant".flags.statevar = true;
70− "text".revision = (((hackage."text")."1.2.3.1").revisions).default;
71− "unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
72− "unordered-containers".flags.debug = false;
73− "base".revision = (((hackage."base")."4.11.1.0").revisions).default;
74− "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
75− "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
76− "hashable".revision = (((hackage."hashable")."1.2.7.0").revisions).default;
77− "hashable".flags.sse2 = true;
78− "hashable".flags.integer-gmp = true;
79− "hashable".flags.sse41 = false;
80− "hashable".flags.examples = false;
81− "attoparsec".revision = (((hackage."attoparsec")."0.13.2.2").revisions).default;
82− "attoparsec".flags.developer = false;
83− "colour".revision = (((hackage."colour")."2.3.5").revisions).default;
84− "filepath".revision = (((hackage."filepath")."1.4.2").revisions).default;
85− "process".revision = (((hackage."process")."1.6.5.0").revisions).default;
86− "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
87− "aeson".revision = (((hackage."aeson")."1.4.3.0").revisions).default;
88− "aeson".flags.cffi = false;
89− "aeson".flags.fast = false;
90− "aeson".flags.bytestring-builder = false;
91− "aeson".flags.developer = false;
92− "ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.4.4").revisions).default;
93− "th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
94− "array".revision = (((hackage."array")."0.5.2.0").revisions).default;
95− "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
96− };
97− compiler = {
98− version = "8.4.4";
99− nix-name = "ghc844";
100− packages = {
101− "binary" = "0.8.5.1";
102− "ghc-prim" = "0.5.2.0";
103− "stm" = "2.4.5.1";
104− "unix" = "2.7.2.2";
105− "rts" = "1.0";
106− "deepseq" = "1.4.3.0";
107− "directory" = "1.3.1.5";
108− "template-haskell" = "2.13.0.0";
109− "containers" = "0.5.11.0";
110− "bytestring" = "0.10.8.2";
111− "text" = "1.2.3.1";
112− "base" = "4.11.1.0";
113− "time" = "1.8.0.2";
114− "filepath" = "1.4.2";
115− "pretty" = "1.1.3.6";
116− "ghc-boot-th" = "8.4.4";
117− "array" = "0.5.2.0";
118− "integer-gmp" = "1.0.2.0";
119− };
120− };
121− };
122− extras = hackage:
123− { packages = { cabal-simple = ./.plan.nix/cabal-simple.nix; }; };
124− }
test/cabal-simple/.plan.nix/cabal-simple.nixdeleted−79
@@ -1,79 +0,0 @@
1−let
2− buildDepError = pkg:
3− builtins.throw ''
4− The Haskell package set does not contain the package: ${pkg} (build dependency).
5−
6− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7− '';
8− sysDepError = pkg:
9− builtins.throw ''
10− The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11−
12− You may need to augment the system package mapping in haskell.nix so that it can be found.
13− '';
14− pkgConfDepError = pkg:
15− builtins.throw ''
16− The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17−
18− You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19− '';
20− exeDepError = pkg:
21− builtins.throw ''
22− The local executable components do not include the component: ${pkg} (executable dependency).
23− '';
24− legacyExeDepError = pkg:
25− builtins.throw ''
26− The Haskell package set does not contain the package: ${pkg} (executable dependency).
27−
28− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29− '';
30− buildToolDepError = pkg:
31− builtins.throw ''
32− Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33−
34− If this is a system dependency:
35− You may need to augment the system package mapping in haskell.nix so that it can be found.
36−
37− If this is a Haskell dependency:
38− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39− '';
40−in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41− {
42− flags = {};
43− package = {
44− specVersion = "1.10";
45− identifier = { name = "cabal-simple"; version = "0.1.0.0"; };
46− license = "LicenseRef-PublicDomain";
47− copyright = "";
48− maintainer = "rodney.lorrimar@iohk.io";
49− author = "Rodney Lorrimar";
50− homepage = "";
51− url = "";
52− synopsis = "";
53− description = "";
54− buildType = "Simple";
55− isLocal = true;
56− };
57− components = {
58− "library" = {
59− depends = [
60− (hsPkgs."base" or (buildDepError "base"))
61− (hsPkgs."extra" or (buildDepError "extra"))
62− (hsPkgs."safe" or (buildDepError "safe"))
63− (hsPkgs."aeson" or (buildDepError "aeson"))
64− ];
65− buildable = true;
66− };
67− exes = {
68− "cabal-simple" = {
69− depends = [
70− (hsPkgs."base" or (buildDepError "base"))
71− (hsPkgs."cabal-simple" or (buildDepError "cabal-simple"))
72− (hsPkgs."extra" or (buildDepError "extra"))
73− (hsPkgs."optparse-applicative" or (buildDepError "optparse-applicative"))
74− ];
75− buildable = true;
76− };
77− };
78− };
79− } // rec { src = (pkgs.lib).mkDefault ../.; }
test/cabal-simple/default.nix+22−16
@@ -1,12 +1,10 @@
11# Test a package set
2−{ stdenv, util, mkCabalProjectPkgSet, gmp6, zlib }:
2+{ stdenv, util, mkCabalProjectPkgSet, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs }:
33
44with stdenv.lib;
55
66let
7− pkgSet = mkCabalProjectPkgSet {
8− plan-pkgs = import ./pkgs.nix;
9− modules = [
7+ modules = [
108 {
119 # Package has no exposed modules which causes
1210 # haddock: No input file(s)
@@ -25,24 +23,35 @@ let
2523 # "--ghc-option=-optl=-L${zlib.static}/lib"
2624 ];
2725 }
28− ];
26+ ];
27+
28+ project = cabalProject' {
29+ name = "cabal-simple";
30+ src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-simple"; };
31+ inherit modules;
2932 };
3033
31− packages = pkgSet.config.hsPkgs;
34+ packages = project.hsPkgs;
35+
36+in recurseIntoAttrs {
37+ inherit (project) plan-nix;
38+
39+ # Used for testing externally with nix-shell (../tests.sh).
40+ # This just adds cabal-install to the existing shells.
41+ test-shell = util.addCabalInstall packages.cabal-simple.components.all;
3242
33−in
34− stdenv.mkDerivation {
43+ run = stdenv.mkDerivation {
3544 name = "cabal-simple-test";
3645
3746 buildCommand = ''
38− exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
47+ exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
3948
4049 size=$(command stat --format '%s' "$exe")
4150 printf "size of executable $exe is $size. \n" >& 2
4251
4352 # fixme: run on target platform when cross-compiled
4453 printf "checking whether executable runs... " >& 2
45− $exe
54+ cat ${packages.cabal-simple.components.exes.cabal-simple.run}
4655 '' + (if stdenv.hostPlatform.isMusl then ''
4756 printf "checking that executable is statically linked... " >& 2
4857 (ldd $exe 2>&1 || true) | grep -i "not a"
@@ -55,7 +64,7 @@ in
5564 '') + ''
5665
5766 printf "Checking that \"all\" component has the programs... " >& 2
58− all_exe="${packages.cabal-simple.components.all}/bin/cabal-simple"
67+ all_exe="${packages.cabal-simple.components.all}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
5968 test -f "$all_exe"
6069 echo "$all_exe" >& 2
6170
@@ -66,10 +75,7 @@ in
6675
6776 passthru = {
6877 # Used for debugging with nix repl
69− inherit pkgSet packages;
70−
71− # Used for testing externally with nix-shell (../tests.sh).
72− # This just adds cabal-install to the existing shells.
73− test-shell = util.addCabalInstall packages.cabal-simple.components.all;
78+ inherit project packages;
7479 };
80+ };
7581}
test/cabal-simple/pkgs.nixdeleted−124
@@ -1,124 +0,0 @@
1−{
2− pkgs = hackage:
3− {
4− packages = {
5− "binary".revision = (((hackage."binary")."0.8.6.0").revisions).default;
6− "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
7− "extra".revision = (((hackage."extra")."1.6.18").revisions).default;
8− "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
9− "rts".revision = (((hackage."rts")."1.0").revisions).default;
10− "clock".revision = (((hackage."clock")."0.8").revisions).default;
11− "clock".flags.llvm = false;
12− "scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
13− "scientific".flags.integer-simple = false;
14− "scientific".flags.bytestring-builder = false;
15− "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
16− "random".revision = (((hackage."random")."1.1").revisions).default;
17− "uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
18− "optparse-applicative".revision = (((hackage."optparse-applicative")."0.15.1.0").revisions).default;
19− "dlist".revision = (((hackage."dlist")."0.8.0.7").revisions).default;
20− "semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default;
21− "semigroups".flags.bytestring = true;
22− "semigroups".flags.unordered-containers = true;
23− "semigroups".flags.text = true;
24− "semigroups".flags.tagged = true;
25− "semigroups".flags.containers = true;
26− "semigroups".flags.binary = true;
27− "semigroups".flags.hashable = true;
28− "semigroups".flags.transformers = true;
29− "semigroups".flags.deepseq = true;
30− "semigroups".flags.bytestring-builder = false;
31− "semigroups".flags.template-haskell = true;
32− "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
33− "transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
34− "transformers-compat".flags.five = false;
35− "transformers-compat".flags.generic-deriving = true;
36− "transformers-compat".flags.two = false;
37− "transformers-compat".flags.five-three = true;
38− "transformers-compat".flags.mtl = true;
39− "transformers-compat".flags.four = false;
40− "transformers-compat".flags.three = false;
41− "template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
42− "vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
43− "vector".flags.unsafechecks = false;
44− "vector".flags.internalchecks = false;
45− "vector".flags.wall = false;
46− "vector".flags.boundschecks = true;
47− "primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
48− "safe".revision = (((hackage."safe")."0.3.17").revisions).default;
49− "base-compat".revision = (((hackage."base-compat")."0.11.0").revisions).default;
50− "time-compat".revision = (((hackage."time-compat")."1.9.2.2").revisions).default;
51− "time-compat".flags.old-locale = false;
52− "ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
53− "ansi-terminal".flags.example = false;
54− "tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
55− "tagged".flags.transformers = true;
56− "tagged".flags.deepseq = true;
57− "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
58− "integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
59− "integer-logarithms".flags.check-bounds = false;
60− "integer-logarithms".flags.integer-gmp = true;
61− "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
62− "ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
63− "ansi-wl-pprint".flags.example = false;
64− "text".revision = (((hackage."text")."1.2.3.1").revisions).default;
65− "unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
66− "unordered-containers".flags.debug = false;
67− "base".revision = (((hackage."base")."4.12.0.0").revisions).default;
68− "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
69− "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
70− "hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default;
71− "hashable".flags.sse2 = true;
72− "hashable".flags.integer-gmp = true;
73− "hashable".flags.sse41 = false;
74− "hashable".flags.examples = false;
75− "attoparsec".revision = (((hackage."attoparsec")."0.13.2.3").revisions).default;
76− "attoparsec".flags.developer = false;
77− "colour".revision = (((hackage."colour")."2.3.5").revisions).default;
78− "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
79− "process".revision = (((hackage."process")."1.6.5.0").revisions).default;
80− "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
81− "aeson".revision = (((hackage."aeson")."1.4.5.0").revisions).default;
82− "aeson".flags.cffi = false;
83− "aeson".flags.fast = false;
84− "aeson".flags.bytestring-builder = false;
85− "aeson".flags.developer = false;
86− "ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
87− "base-orphans".revision = (((hackage."base-orphans")."0.8.1").revisions).default;
88− "th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
89− "array".revision = (((hackage."array")."0.5.3.0").revisions).default;
90− "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
91− };
92− compiler = {
93− version = "8.6.5";
94− nix-name = "ghc865";
95− packages = {
96− "binary" = "0.8.6.0";
97− "ghc-prim" = "0.5.3";
98− "unix" = "2.7.2.2";
99− "rts" = "1.0";
100− "deepseq" = "1.4.4.0";
101− "directory" = "1.3.3.0";
102− "template-haskell" = "2.14.0.0";
103− "containers" = "0.6.0.1";
104− "bytestring" = "0.10.8.2";
105− "text" = "1.2.3.1";
106− "base" = "4.12.0.0";
107− "time" = "1.8.0.2";
108− "transformers" = "0.5.6.2";
109− "filepath" = "1.4.2.1";
110− "process" = "1.6.5.0";
111− "pretty" = "1.1.3.6";
112− "ghc-boot-th" = "8.6.5";
113− "array" = "0.5.3.0";
114− "integer-gmp" = "1.0.2.0";
115− };
116− };
117− };
118− extras = hackage:
119− { packages = { cabal-simple = ./.plan.nix/cabal-simple.nix; }; };
120− modules = [
121− ({ lib, ... }:
122− { packages = { "cabal-simple" = { flags = {}; }; }; })
123− ];
124− }
test/cabal-source-repo/default.nix+13−14
@@ -1,26 +1,24 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, cabalProject', recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− pkgSet = mkCabalProjectPkgSet {
7− plan-pkgs = (importAndFilterProject (callCabalProjectToNix {
8− name = "test-cabal-source-repo";
9− index-state = "2019-04-30T00:00:00Z";
10− # reuse the cabal-simple test project
11− src = ./.;
12− })).pkgs;
6+ project = cabalProject' {
7+ name = "test-cabal-source-repo";
8+ index-state = "2019-04-30T00:00:00Z";
9+ src = ./.;
1310 };
14− packages = pkgSet.config.hsPkgs;
15−in
16− stdenv.mkDerivation {
11+ packages = project.hsPkgs;
12+in recurseIntoAttrs {
13+ inherit (project) plan-nix;
14+ run = stdenv.mkDerivation {
1715 name = "call-cabal-project-to-nix-test";
1816
1917 buildCommand = ''
20− exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple"
18+ exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple${stdenv.hostPlatform.extensions.executable}"
2119
2220 printf "checking whether executable runs... " >& 2
23− $exe
21+ cat ${packages.use-cabal-simple.components.exes.use-cabal-simple.run}
2422
2523 touch $out
2624 '';
@@ -31,4 +29,5 @@ in
3129 # Attributes used for debugging with nix repl
3230 inherit pkgSet packages;
3331 };
34− }
32+ };
33+}
test/cabal-sublib/.plan.nix/cabal-sublib.nixdeleted−87
@@ -1,87 +0,0 @@
1−let
2− buildDepError = pkg:
3− builtins.throw ''
4− The Haskell package set does not contain the package: ${pkg} (build dependency).
5−
6− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
7− '';
8− sysDepError = pkg:
9− builtins.throw ''
10− The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
11−
12− You may need to augment the system package mapping in haskell.nix so that it can be found.
13− '';
14− pkgConfDepError = pkg:
15− builtins.throw ''
16− The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
17−
18− You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
19− '';
20− exeDepError = pkg:
21− builtins.throw ''
22− The local executable components do not include the component: ${pkg} (executable dependency).
23− '';
24− legacyExeDepError = pkg:
25− builtins.throw ''
26− The Haskell package set does not contain the package: ${pkg} (executable dependency).
27−
28− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
29− '';
30− buildToolDepError = pkg:
31− builtins.throw ''
32− Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
33−
34− If this is a system dependency:
35− You may need to augment the system package mapping in haskell.nix so that it can be found.
36−
37− If this is a Haskell dependency:
38− If you are using Stackage, make sure that you are using a snapshot that contains the package. Otherwise you may need to update the Hackage snapshot you are using, usually by updating haskell.nix.
39− '';
40−in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
41− {
42− flags = {};
43− package = {
44− specVersion = "2.2";
45− identifier = { name = "cabal-sublib"; version = "0.1.0.0"; };
46− license = "MIT";
47− copyright = "";
48− maintainer = "moritz.angermann@iohk.io";
49− author = "Moritz Angermann";
50− homepage = "";
51− url = "";
52− synopsis = "";
53− description = "";
54− buildType = "Simple";
55− isLocal = true;
56− };
57− components = {
58− "library" = {
59− depends = [
60− (hsPkgs."base" or (buildDepError "base"))
61− (hsPkgs."slib" or (buildDepError "slib"))
62− ];
63− buildable = true;
64− };
65− sublibs = {
66− "slib" = {
67− depends = [
68− (hsPkgs."extra" or (buildDepError "extra"))
69− (hsPkgs."safe" or (buildDepError "safe"))
70− (hsPkgs."aeson" or (buildDepError "aeson"))
71− ];
72− buildable = true;
73− };
74− };
75− exes = {
76− "cabal-sublib" = {
77− depends = [
78− (hsPkgs."base" or (buildDepError "base"))
79− (hsPkgs."cabal-sublib" or (buildDepError "cabal-sublib"))
80− (hsPkgs."extra" or (buildDepError "extra"))
81− (hsPkgs."optparse-applicative" or (buildDepError "optparse-applicative"))
82− ];
83− buildable = true;
84− };
85− };
86− };
87− } // rec { src = (pkgs.lib).mkDefault ../.; }
test/cabal-sublib/default.nix+22−16
@@ -1,35 +1,40 @@
11# Test a package set
2−{ stdenv, util, mkCabalProjectPkgSet }:
2+{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs }:
33
44with stdenv.lib;
55
66let
7− pkgSet = mkCabalProjectPkgSet {
8− plan-pkgs = import ./pkgs.nix;
9− modules = [
10− {
11− # Package has no exposed modules which causes
12− # haddock: No input file(s)
13− packages.cabal-sublib.doHaddock = false;
14− }
15− ];
7+ modules = [
8+ {
9+ # Package has no exposed modules which causes
10+ # haddock: No input file(s)
11+ packages.cabal-sublib.doHaddock = false;
12+ }
13+ ];
14+
15+ # The ./pkgs.nix works for linux & darwin, but not for windows
16+ project = cabalProject' {
17+ name = "cabal-sublib";
18+ src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-sublib"; };
19+ inherit modules;
1620 };
1721
18− packages = pkgSet.config.hsPkgs;
22+ packages = project.hsPkgs;
1923
20−in
21− stdenv.mkDerivation {
24+in recurseIntoAttrs {
25+ inherit (project) plan-nix;
26+ run = stdenv.mkDerivation {
2227 name = "cabal-sublib-test";
2328
2429 buildCommand = ''
25− exe="${packages.cabal-sublib.components.exes.cabal-sublib}/bin/cabal-sublib"
30+ exe="${packages.cabal-sublib.components.exes.cabal-sublib}/bin/cabal-sublib${stdenv.hostPlatform.extensions.executable}"
2631
2732 size=$(command stat --format '%s' "$exe")
2833 printf "size of executable $exe is $size. \n" >& 2
2934
3035 # fixme: run on target platform when cross-compiled
3136 printf "checking whether executable runs... " >& 2
32− $exe
37+ cat ${packages.cabal-sublib.components.exes.cabal-sublib.run}
3338
3439 printf "checking that executable is dynamically linked to system libraries... " >& 2
3540 '' + optionalString stdenv.isLinux ''
@@ -39,7 +44,7 @@ in
3944 '' + ''
4045
4146 printf "Checking that \"all\" component has the programs... " >& 2
42− all_exe="${packages.cabal-sublib.components.all}/bin/cabal-sublib"
47+ all_exe="${packages.cabal-sublib.components.all}/bin/cabal-sublib${stdenv.hostPlatform.extensions.executable}"
4348 test -f "$all_exe"
4449 echo "$all_exe" >& 2
4550
@@ -56,4 +61,5 @@ in
5661 # This just adds cabal-install to the existing shells.
5762 test-shell = util.addCabalInstall packages.cabal-sublib.components.all;
5863 };
64+ };
5965}
test/cabal-sublib/pkgs.nixdeleted−124
@@ -1,124 +0,0 @@
1−{
2− pkgs = hackage:
3− {
4− packages = {
5− "binary".revision = (((hackage."binary")."0.8.6.0").revisions).default;
6− "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
7− "extra".revision = (((hackage."extra")."1.6.18").revisions).default;
8− "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
9− "rts".revision = (((hackage."rts")."1.0").revisions).default;
10− "clock".revision = (((hackage."clock")."0.8").revisions).default;
11− "clock".flags.llvm = false;
12− "scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
13− "scientific".flags.integer-simple = false;
14− "scientific".flags.bytestring-builder = false;
15− "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
16− "random".revision = (((hackage."random")."1.1").revisions).default;
17− "uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
18− "optparse-applicative".revision = (((hackage."optparse-applicative")."0.15.1.0").revisions).default;
19− "dlist".revision = (((hackage."dlist")."0.8.0.7").revisions).default;
20− "semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default;
21− "semigroups".flags.bytestring = true;
22− "semigroups".flags.unordered-containers = true;
23− "semigroups".flags.text = true;
24− "semigroups".flags.tagged = true;
25− "semigroups".flags.containers = true;
26− "semigroups".flags.binary = true;
27− "semigroups".flags.hashable = true;
28− "semigroups".flags.transformers = true;
29− "semigroups".flags.deepseq = true;
30− "semigroups".flags.bytestring-builder = false;
31− "semigroups".flags.template-haskell = true;
32− "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
33− "transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
34− "transformers-compat".flags.five = false;
35− "transformers-compat".flags.generic-deriving = true;
36− "transformers-compat".flags.two = false;
37− "transformers-compat".flags.five-three = true;
38− "transformers-compat".flags.mtl = true;
39− "transformers-compat".flags.four = false;
40− "transformers-compat".flags.three = false;
41− "template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
42− "vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
43− "vector".flags.unsafechecks = false;
44− "vector".flags.internalchecks = false;
45− "vector".flags.wall = false;
46− "vector".flags.boundschecks = true;
47− "primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
48− "safe".revision = (((hackage."safe")."0.3.17").revisions).default;
49− "base-compat".revision = (((hackage."base-compat")."0.11.0").revisions).default;
50− "time-compat".revision = (((hackage."time-compat")."1.9.2.2").revisions).default;
51− "time-compat".flags.old-locale = false;
52− "ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
53− "ansi-terminal".flags.example = false;
54− "tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
55− "tagged".flags.transformers = true;
56− "tagged".flags.deepseq = true;
57− "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
58− "integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
59− "integer-logarithms".flags.check-bounds = false;
60− "integer-logarithms".flags.integer-gmp = true;
61− "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
62− "ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
63− "ansi-wl-pprint".flags.example = false;
64− "text".revision = (((hackage."text")."1.2.3.1").revisions).default;
65− "unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
66− "unordered-containers".flags.debug = false;
67− "base".revision = (((hackage."base")."4.12.0.0").revisions).default;
68− "time".revision = (((hackage."time")."1.8.0.2").revisions).default;
69− "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
70− "hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default;
71− "hashable".flags.sse2 = true;
72− "hashable".flags.integer-gmp = true;
73− "hashable".flags.sse41 = false;
74− "hashable".flags.examples = false;
75− "attoparsec".revision = (((hackage."attoparsec")."0.13.2.3").revisions).default;
76− "attoparsec".flags.developer = false;
77− "colour".revision = (((hackage."colour")."2.3.5").revisions).default;
78− "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
79− "process".revision = (((hackage."process")."1.6.5.0").revisions).default;
80− "pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
81− "aeson".revision = (((hackage."aeson")."1.4.5.0").revisions).default;
82− "aeson".flags.cffi = false;
83− "aeson".flags.fast = false;
84− "aeson".flags.bytestring-builder = false;
85− "aeson".flags.developer = false;
86− "ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
87− "base-orphans".revision = (((hackage."base-orphans")."0.8.1").revisions).default;
88− "th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
89− "array".revision = (((hackage."array")."0.5.3.0").revisions).default;
90− "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
91− };
92− compiler = {
93− version = "8.6.5";
94− nix-name = "ghc865";
95− packages = {
96− "binary" = "0.8.6.0";
97− "ghc-prim" = "0.5.3";
98− "unix" = "2.7.2.2";
99− "rts" = "1.0";
100− "deepseq" = "1.4.4.0";
101− "directory" = "1.3.3.0";
102− "template-haskell" = "2.14.0.0";
103− "containers" = "0.6.0.1";
104− "bytestring" = "0.10.8.2";
105− "text" = "1.2.3.1";
106− "base" = "4.12.0.0";
107− "time" = "1.8.0.2";
108− "transformers" = "0.5.6.2";
109− "filepath" = "1.4.2.1";
110− "process" = "1.6.5.0";
111− "pretty" = "1.1.3.6";
112− "ghc-boot-th" = "8.6.5";
113− "array" = "0.5.3.0";
114− "integer-gmp" = "1.0.2.0";
115− };
116− };
117− };
118− extras = hackage:
119− { packages = { cabal-sublib = ./.plan.nix/cabal-sublib.nix; }; };
120− modules = [
121− ({ lib, ... }:
122− { packages = { "cabal-sublib" = { flags = {}; }; }; })
123− ];
124− }
test/call-cabal-project-to-nix/default.nix+18−12
@@ -1,26 +1,31 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6+ # This test could use cabalProject', but it does so that it
7+ # tests using callCabalProjectToNix and importAndFilterProject
8+ plan = (importAndFilterProject (callCabalProjectToNix {
9+ name = "test-call-cabal-project-to-nix";
10+ index-state = "2019-04-30T00:00:00Z";
11+ # reuse the cabal-simple test project
12+ src = ../cabal-simple;
13+ }));
614 pkgSet = mkCabalProjectPkgSet {
7− plan-pkgs = (importAndFilterProject (callCabalProjectToNix {
8− name = "test-call-cabal-project-to-nix";
9− index-state = "2019-04-30T00:00:00Z";
10− # reuse the cabal-simple test project
11− src = ../cabal-simple;
12− })).pkgs;
15+ plan-pkgs = plan.pkgs;
1316 };
1417 packages = pkgSet.config.hsPkgs;
15−in
16− stdenv.mkDerivation {
18+
19+in recurseIntoAttrs {
20+ plan-nix = plan.nix;
21+ run = stdenv.mkDerivation {
1722 name = "call-cabal-project-to-nix-test";
1823
1924 buildCommand = ''
20− exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
25+ exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
2126
2227 printf "checking whether executable runs... " >& 2
23− $exe
28+ cat ${packages.cabal-simple.components.exes.cabal-simple.run}
2429
2530 touch $out
2631 '';
@@ -31,4 +36,5 @@ in
3136 # Attributes used for debugging with nix repl
3237 inherit pkgSet packages;
3338 };
34− }
39+ };
40+}
test/call-stack-to-nix/default.nix+13−9
@@ -1,25 +1,28 @@
1−{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
1+{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6+ stack = importAndFilterProject (callStackToNix {
7+ src = ../stack-simple;
8+ });
69 pkgSet = mkStackPkgSet {
7− stack-pkgs = (importAndFilterProject (callStackToNix {
8− src = ../stack-simple;
9− })).pkgs;
10+ stack-pkgs = stack.pkgs;
1011 pkg-def-extras = [];
1112 modules = [];
1213 };
1314 packages = pkgSet.config.hsPkgs;
14−in
15− stdenv.mkDerivation {
15+
16+in recurseIntoAttrs {
17+ stack-nix = stack.nix;
18+ run = stdenv.mkDerivation {
1619 name = "callStackToNix-test";
1720
1821 buildCommand = ''
19− exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe"
22+ exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe${stdenv.hostPlatform.extensions.executable}"
2023
2124 printf "checking whether executable runs... " >& 2
22− $exe
25+ cat ${packages.stack-simple.components.exes.stack-simple-exe.run}
2326
2427 touch $out
2528 '';
@@ -30,4 +33,5 @@ in
3033 # Attributes used for debugging with nix repl
3134 inherit pkgSet packages;
3235 };
33− }
36+ };
37+}
test/default.nix+1−1
@@ -6,7 +6,7 @@
66with pkgs;
77
88let
9− util = callPackage ./util.nix {};
9+ util = import ./util.nix { inherit (pkgs.haskell-nix) cabal-install; };
1010in pkgs.recurseIntoAttrs {
1111 inherit (haskell-nix) haskellNixRoots;
1212 cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };
test/exe-only/default.nix+5−3
@@ -1,5 +1,5 @@
11# Test a package set
2−{ stdenv, util, haskell-nix }:
2+{ stdenv, util, haskell-nix, recurseIntoAttrs }:
33
44with stdenv.lib;
55
@@ -11,8 +11,9 @@ let
1111
1212 packages = project.hsPkgs;
1313
14−in
15− stdenv.mkDerivation {
14+in recurseIntoAttrs {
15+ inherit (project) plan-nix;
16+ run = stdenv.mkDerivation {
1617 name = "exe-only-test";
1718
1819 buildCommand = ''
@@ -53,4 +54,5 @@ in
5354 # This just adds cabal-install to the existing shells.
5455 test-shell = util.addCabalInstall packages.exe-only.components.all;
5556 };
57+ };
5658}
test/fully-static/default.nix+19−16
@@ -1,22 +1,19 @@
1−{ mkStackPkgSet, callStackToNix, importAndFilterProject
1+{ stackProject'
22, stdenv, gmp6, openssl, zlib, libffi
33, buildPackages
4+, recurseIntoAttrs
45}:
56
67with stdenv.lib;
78
89let
9− # IFD stack-to-nix
10− stack-pkgs = (importAndFilterProject (callStackToNix {
11− src = ./.;
12− })).pkgs;
13−
1410 # Grab the compiler name from stack-to-nix output.
1511 # compiler = (stack-pkgs.extras {}).compiler.nix-name;
1612 compiler = "ghc865"; # fixme
1713
18− pkgSet = { gpl ? true }: mkStackPkgSet {
19− inherit stack-pkgs;
14+ # IFD stack-to-nix
15+ project = { gpl ? true }: stackProject' {
16+ src = ./.;
2017 pkg-def-extras = [];
2118 modules = [
2219 # Musl libc fully static build
@@ -52,10 +49,13 @@ let
5249 })
5350 ];
5451 };
55− packagesGmp = (pkgSet { gpl = true; }).config.hsPkgs;
56− packagesIntegerSimple = (pkgSet { gpl = false; }).config.hsPkgs;
57−in
58− stdenv.mkDerivation {
52+ packagesGmp = (project { gpl = true; }).hsPkgs;
53+ packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
54+
55+in recurseIntoAttrs {
56+ stack-nix-gmp = (project { gpl = true; }).stack-nix;
57+ stack-nix-simple = (project { gpl = false; }).stack-nix;
58+ run = stdenv.mkDerivation {
5959 name = "fully-static-test";
6060
6161 depsBuildBuild = [ buildPackages.file ];
@@ -63,10 +63,10 @@ in
6363 buildCommand = flip concatMapStrings
6464 [ packagesGmp /* packagesIntegerSimple */ ]
6565 (packages: ''
66− exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc"
66+ exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc${stdenv.hostPlatform.extensions.executable}"
6767
6868 printf "checking whether executable runs... " >& 2
69− $exe --version
69+ ${toString packages.pandoc.components.exes.pandoc.config.testWrapper} $exe --version
7070
7171 '' + optionalString stdenv.hostPlatform.isMusl ''
7272 printf "checking whether executable is static... " >& 2
@@ -79,8 +79,11 @@ in
7979
8080 passthru = {
8181 # Attributes used for debugging with nix repl
82− inherit pkgSet buildPackages stack-pkgs;
82+ inherit buildPackages;
83+ project-gmp = project { gpl = true; };
84+ project-integer-simple = project { gpl = false; };
8385 pandoc-gmp = packagesGmp.pandoc.components.exes.pandoc;
8486 pandoc-integer-simple = packagesIntegerSimple.pandoc.components.exes.pandoc;
8587 };
86− }
88+ };
89+}
test/fully-static/stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-13.26
1+resolver: lts-14.13
22
33extra-deps:
44 - pandoc-2.7.3
test/ghc-options/cabal.nix+14−17
@@ -1,28 +1,25 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, cabalProject', recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− plan = (importAndFilterProject (callCabalProjectToNix {
7− name = "test-ghc-options";
8− index-state = "2019-04-30T00:00:00Z";
9− src = ./.;
10− }));
11− pkgSet = mkCabalProjectPkgSet {
12− plan-pkgs = plan.pkgs;
6+ project = cabalProject' {
7+ name = "test-ghc-options";
8+ index-state = "2019-04-30T00:00:00Z";
9+ src = ./.;
1310 # TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix
1411 modules = [ { packages.test-ghc-options.package.ghcOptions = "-DTEST_GHC_OPTION"; } ];
1512 };
16− packages = pkgSet.config.hsPkgs;
17−in
18− stdenv.mkDerivation {
13+ packages = project.hsPkgs;
14+
15+in recurseIntoAttrs {
16+ inherit (project) plan-nix;
17+ run = stdenv.mkDerivation {
1918 name = "call-cabal-project-to-nix-test";
2019
2120 buildCommand = ''
22− exe="${packages.test-ghc-options.components.exes.test-ghc-options-exe}/bin/test-ghc-options-exe"
23−
2421 printf "checking whether executable runs... " >& 2
25− $exe
22+ cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
2623
2724 touch $out
2825 '';
@@ -31,7 +28,7 @@ in
3128
3229 passthru = {
3330 # Attributes used for debugging with nix repl
34− inherit pkgSet packages;
35− plan-nix = plan.nix;
31+ inherit project packages;
3632 };
37− }
33+ };
34+}
test/ghc-options/stack.nix+11−14
@@ -1,24 +1,21 @@
1−{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
1+{ stdenv, stackProject', recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− stack = (importAndFilterProject (callStackToNix {
6+ project = stackProject' {
77 src = ./.;
8− }));
9− pkgSet = mkStackPkgSet {
10− stack-pkgs = stack.pkgs;
118 };
12− packages = pkgSet.config.hsPkgs;
13−in
14− stdenv.mkDerivation {
9+ packages = project.hsPkgs;
10+
11+in recurseIntoAttrs {
12+ inherit (project) stack-nix;
13+ run = stdenv.mkDerivation {
1514 name = "callStackToNix-test";
1615
1716 buildCommand = ''
18− exe="${packages.test-ghc-options.components.exes.test-ghc-options-exe}/bin/test-ghc-options-exe"
19−
2017 printf "checking whether executable runs... " >& 2
21− $exe
18+ cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
2219
2320 touch $out
2421 '';
@@ -27,7 +24,7 @@ in
2724
2825 passthru = {
2926 # Attributes used for debugging with nix repl
30− inherit pkgSet packages;
31− stack-nix = stack.nix;
27+ inherit project packages;
3228 };
33− }
29+ };
30+}
test/ghc-options/stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-13.19
1+resolver: lts-14.13
22
33packages:
44- .
test/project-flags/cabal.nix+14−14
@@ -1,26 +1,25 @@
1−{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, cabalProject', recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− plan = (importAndFilterProject (callCabalProjectToNix {
7− name = "test-project-flags";
8− index-state = "2019-04-30T00:00:00Z";
9− src = ./.;
10− }));
11− pkgSet = mkCabalProjectPkgSet {
12− plan-pkgs = plan.pkgs;
6+ project = cabalProject' {
7+ name = "test-project-flags";
8+ index-state = "2019-04-30T00:00:00Z";
9+ src = ./.;
1310 };
14− packages = pkgSet.config.hsPkgs;
15−in
16− stdenv.mkDerivation {
11+ packages = project.hsPkgs;
12+
13+in recurseIntoAttrs {
14+ inherit (project) plan-nix;
15+ run = stdenv.mkDerivation {
1716 name = "call-cabal-project-to-nix-test";
1817
1918 buildCommand = ''
20− exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe"
19+ exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
2120
2221 printf "checking whether executable runs... " >& 2
23− $exe
22+ cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
2423
2524 touch $out
2625 '';
@@ -32,4 +31,5 @@ in
3231 inherit pkgSet packages;
3332 plan-nix = plan.nix;
3433 };
35− }
34+ };
35+}
test/project-flags/stack.nix+11−11
@@ -1,24 +1,23 @@
1−{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
1+{ stdenv, stackProject', recurseIntoAttrs }:
22
33with stdenv.lib;
44
55let
6− stack = (importAndFilterProject (callStackToNix {
6+ project = stackProject' {
77 src = ./.;
8− }));
9− pkgSet = mkStackPkgSet {
10− stack-pkgs = stack.pkgs;
118 };
12− packages = pkgSet.config.hsPkgs;
13−in
14− stdenv.mkDerivation {
9+ packages = project.hsPkgs;
10+
11+in recurseIntoAttrs {
12+ inherit (project) stack-nix;
13+ run = stdenv.mkDerivation {
1514 name = "callStackToNix-test";
1615
1716 buildCommand = ''
18− exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe"
17+ exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
1918
2019 printf "checking whether executable runs... " >& 2
21− $exe
20+ cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
2221
2322 touch $out
2423 '';
@@ -30,4 +29,5 @@ in
3029 inherit pkgSet packages;
3130 stack-nix = stack.nix;
3231 };
33− }
32+ };
33+}
test/project-flags/stack.yaml+1−1
@@ -1,4 +1,4 @@
1−resolver: lts-13.19
1+resolver: lts-14.13
22
33packages:
44- .
test/setup-deps/default.nix+17−6
@@ -6,7 +6,7 @@ with stdenv.lib;
66let
77 project = haskell-nix.cabalProject' {
88 name = "test-setup-deps";
9− src = ./.;
9+ src = pkgs.haskell-nix.haskellLib.cleanGit { src = ../..; subDir = "test/setup-deps"; };
1010 modules = [{
1111 # Package has no exposed modules which causes
1212 # haddock: No input file(s)
@@ -16,10 +16,20 @@ let
1616 };
1717
1818 packages = project.hsPkgs;
19−in recurseIntoAttrs {
20− plan = haskell-nix.withInputs project.plan-nix;
19+in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
20+ then
21+ let skip = pkgs.runCommand "skip-test-setup-deps" {} ''
22+ echo "Skipping setup-deps test on windows as it needs the ghc lib" >& 2
23+ touch $out
24+ '';
25+ in {
26+ plan-nix = skip;
27+ run = skip;
28+ }
29+ else {
30+ inherit (project) plan-nix;
2131 run = pkgs.stdenv.mkDerivation {
22− name = "call-cabal-project-to-nix-test";
32+ name = "setup-deps-test";
2333
2434 buildCommand = ''
2535 exe="${packages.pkg.components.exes.pkg}/bin/pkg"
@@ -30,11 +40,12 @@ in recurseIntoAttrs {
3040 touch $out
3141 '';
3242
33− meta.platforms = platforms.all;
43+ meta.platforms = platforms.unix;
44+ meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
3445
3546 passthru = {
3647 # Attributes used for debugging with nix repl
3748 inherit project packages;
3849 };
3950 };
40−}
51+})
test/shell-for-setup-deps/default.nix+22−12
@@ -1,14 +1,11 @@
1−{ stdenv, cabal-install, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
1+{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand }:
22
33with stdenv.lib;
44
55let
6− plan = importAndFilterProject (callCabalProjectToNix {
6+ project = cabalProject' {
77 name = "test-shell-for-setup-deps";
88 src = ./.;
9− });
10− pkgSet = mkCabalProjectPkgSet {
11− plan-pkgs = plan.pkgs;
129 modules = [{
1310 # Package has no exposed modules which causes
1411 # haddock: No input file(s)
@@ -16,10 +13,23 @@ let
1613 }];
1714 };
1815
19− env = pkgSet.config.hsPkgs.shellFor {};
16+ env = project.hsPkgs.shellFor {};
2017
21− in
22− stdenv.mkDerivation {
18+in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
19+ then
20+ let skip = runCommand "skipping-test-shell-for-setup-deps" {} ''
21+ echo "Skipping shell-for-setup-deps test on windows as does not work yet" >& 2
22+ touch $out
23+ '';
24+ in {
25+ plan-nix = skip;
26+ env = skip;
27+ run = skip;
28+ }
29+ else {
30+ inherit (project) plan-nix;
31+ inherit env;
32+ run = stdenv.mkDerivation {
2333 name = "shell-for-test";
2434
2535 buildCommand = ''
@@ -35,14 +45,14 @@ let
3545 '';
3646
3747 meta.platforms = platforms.all;
38− meta.disabled = stdenv.hostPlatform.isMusl;
48+ meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
3949
4050 passthru = {
4151 # Used for debugging with nix repl
4252 inherit pkgSet;
4353
4454 # Used for testing externally with nix-shell (../tests.sh).
45− inherit env;
46− plan-nix = plan.nix;
55+ inherit project env;
4756 };
48−}
57+ };
58+})
test/shell-for/default.nix+19−5
@@ -1,4 +1,4 @@
1−{ stdenv, cabal-install, mkCabalProjectPkgSet }:
1+{ stdenv, cabal-install, mkCabalProjectPkgSet, recurseIntoAttrs, runCommand }:
22
33with stdenv.lib;
44
@@ -44,8 +44,21 @@ let
4444 buildInputs = [ cabal-install ];
4545 };
4646
47− in
48− stdenv.mkDerivation {
47+in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
48+ then
49+ let skip = runCommand "skip-test-shell-for" {} ''
50+ echo "Skipping shell-for test on windows as does not work yet" >& 2
51+ touch $out
52+ '';
53+ in {
54+ env = skip;
55+ envPkga = skip;
56+ envDefault = skip;
57+ run = skip;
58+ }
59+ else {
60+ inherit env envPkga envDefault;
61+ run = stdenv.mkDerivation {
4962 name = "shell-for-test";
5063
5164 buildCommand = ''
@@ -64,7 +77,7 @@ let
6477 '';
6578
6679 meta.platforms = platforms.all;
67− meta.disabled = stdenv.hostPlatform.isMusl;
80+ meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
6881
6982 passthru = {
7083 # Used for debugging with nix repl
@@ -73,4 +86,5 @@ let
7386 # Used for testing externally with nix-shell (../tests.sh).
7487 inherit env envPkga envDefault;
7588 };
76−}
89+ };
90+})
test/snapshots/default.nix+23−6
@@ -1,16 +1,32 @@
1−{ stdenv, haskellPackages, snapshots }:
1+{ stdenv, haskellPackages, snapshots, recurseIntoAttrs, runCommand }:
22
33with stdenv.lib;
44
55let
6− env = snapshots."lts-12.21".ghcWithHoogle
6+ env = snapshots."lts-14.13".ghcWithHoogle
77 (ps: with ps; [ conduit conduit-extra resourcet ]);
88
9−in
10− stdenv.mkDerivation {
9+in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
10+ then
11+ let skip = runCommand "skip-test-snapshot" {} ''
12+ echo "Skipping snapshot test on windows as does not work yet" >& 2
13+ touch $out
14+ '';
15+ in {
16+ env = skip;
17+ run = skip;
18+ }
19+ else {
20+ inherit env;
21+ run = stdenv.mkDerivation {
1122 name = "shell-for-test";
1223
13− buildCommand = ''
24+ buildCommand = if stdenv.hostPlatform.isWindows
25+ then ''
26+ printf "snapshot test is not working yet for windows. skipping. " >& 2
27+ touch $out
28+ ''
29+ else ''
1430 ########################################################################
1531 # test single component from haskellPackages
1632
@@ -33,4 +49,5 @@ in
3349 passthru = {
3450 inherit env;
3551 };
36−}
52+ };
53+})
test/with-packages/default.nix+24−19
@@ -1,4 +1,4 @@
1−{ stdenv, util, mkPkgSet }:
1+{ stdenv, util, mkPkgSet, recurseIntoAttrs }:
22
33with stdenv.lib;
44with util;
@@ -35,8 +35,15 @@ let
3535 pkgId = p: "${p.identifier.name}-${p.identifier.version}";
3636 showDepends = component: concatMapStringsSep " " pkgId component.depends;
3737
38−in
39− stdenv.mkDerivation {
38+in recurseIntoAttrs {
39+ # Used for testing externally with nix-shell (../tests.sh).
40+ # This just adds cabal-install to the existing shells.
41+ test-shell = addCabalInstall packages.test-with-packages.components.all;
42+
43+ # A variant of test-shell with the component option doExactConfig enabled
44+ test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
45+
46+ run = stdenv.mkDerivation {
4047 name = "with-packages-test";
4148 libraryDepends = showDepends pkgSet.config.packages.test-with-packages.components.library;
4249 allDepends = showDepends pkgSet.config.packages.test-with-packages.components.all;
@@ -60,15 +67,19 @@ in
6067
6168 printf "checking that the 'library' component works... " >& 2
6269 echo ${package.components.library} >& 2
63−
64− printf "checking that the package env has the dependencies... " >& 2
65− ${package.components.all.env}/bin/runghc ${./Point.hs}
66− echo >& 2
67−
68− printf "checking that components.library.env has the dependencies... " >& 2
69− ${library.env}/bin/runghc ${./Point.hs}
70− echo >& 2
71−
70+ '' + (if stdenv.hostPlatform.isWindows
71+ then ''
72+ printf "runghc tests are not working yet for windows. skipping. " >& 2
73+ ''
74+ else ''
75+ printf "checking that the package env has the dependencies... " >& 2
76+ ${package.components.all.env}/bin/runghc ${./Point.hs}
77+ echo >& 2
78+
79+ printf "checking that components.library.env has the dependencies... " >& 2
80+ ${library.env}/bin/runghc ${./Point.hs}
81+ echo >& 2
82+ '') + ''
7283 touch $out
7384 '';
7485
@@ -78,12 +89,6 @@ in
7889 passthru = {
7990 # Used for debugging with nix repl
8091 inherit packages pkgSet;
81−
82− # Used for testing externally with nix-shell (../tests.sh).
83− # This just adds cabal-install to the existing shells.
84− test-shell = addCabalInstall packages.test-with-packages.components.all;
85−
86− # A variant of test-shell with the component option doExactConfig enabled
87− test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
8892 };
93+ };
8994}