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.
This commit is contained in:
Hamish Mackenzie 2019-11-20 13:47:15 +13:00 committed by GitHub
parent d8ab386a67
commit 79c2c631c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
41 changed files with 398 additions and 1105 deletions

View File

@ -21,6 +21,7 @@ let
name = "darcs";
version = "2.14.2";
index-state = "2019-10-28T00:00:00Z";
plan-sha256 = "1h8dxib0wz6mg8md6ldwa54dsr1dn7vxfij8cfhdawl4y3wr51k0";
# Apply the latest darcs.net Setup.hs patches
modules = [{packages.darcs.patches = [ ./patches/darcs-setup.patch ];}];
}).components.exes.darcs;
@ -38,7 +39,7 @@ in rec {
update-hackage = haskell.callPackage ./scripts/update-hackage.nix {};
update-stackage = haskell.callPackage ./scripts/update-stackage.nix {};
update-pins = haskell.callPackage ./scripts/update-pins.nix {};
update-docs = haskell.callPackage ./scripts/update-docs.nix {
update-docs = pkgs.buildPackages.callPackage ./scripts/update-docs.nix {
generatedOptions = import ./scripts/options-doc.nix {
# nixpkgs unstable changes "Option has no description" from an
# error into a warning. That is quite helpful when hardly any
@ -51,8 +52,10 @@ in rec {
}) {};
};
};
check-hydra = haskell.callPackage ./scripts/check-hydra.nix {};
check-closure-size = haskell.callPackage ./scripts/check-closure-size.nix {};
check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {};
check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix {
inherit (haskell) nix-tools;
};
};
# These are pure parts of maintainer-script so they can be built by hydra
@ -61,7 +64,7 @@ in rec {
inherit (maintainer-scripts) update-docs check-hydra check-closure-size;
# Some of the dependencies of the impure scripts so that they will
# will be in the cache too for buildkite.
inherit (pkgs) coreutils glibc git openssh cabal-install nix-prefetch-git;
inherit (pkgs.buildPackages) glibc coreutils git openssh cabal-install nix-prefetch-git;
inherit (haskell) nix-tools;
};
}

View File

@ -174,7 +174,7 @@ let
# project where the files haven't been added to the git
# repo yet. We fail early and provide a useful error
# message to prevent headaches (#290).
if [ -z "$(ls -A ${maybeCleanedSource})" ];
if [ -z "$(ls -A ${maybeCleanedSource})" ]; then
echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
fi
cp -r ${maybeCleanedSource}/* .

View File

@ -192,7 +192,7 @@ in {
};
hsSourceDirs = mkOption {
type = listOfFilteringNulls unspecified;
default = [];
default = ["."];
};
includeDirs = mkOption {
type = listOfFilteringNulls unspecified;

View File

@ -1,7 +1,7 @@
{
"url": "https://github.com/input-output-hk/nixpkgs",
"rev": "3d623a406cec9052ae0a16a79ce3ce9de11236bb",
"date": "2019-10-18T17:51:24+13:00",
"sha256": "1a4yd980ylh1ygvmws15wldifz7jxjy8z07vc914kam1p25yjpj1",
"rev": "31aa5316ca232a53667790a99e8b1e76252e065c",
"date": "2019-11-16T23:51:02+13:00",
"sha256": "0g0r473rdrh5vsdvr45nmfs6ibp0pqyzbw9f0iv6r0jkg6jjiykr",
"fetchSubmodules": false
}

View File

@ -1,7 +1,7 @@
{
"url": "https://github.com/nixos/nixpkgs",
"rev": "49ac77d07eb9757244b776e35b9eb68d63943b12",
"date": "2019-07-30T15:46:41+02:00",
"sha256": "0xsmh17z5bl17dnpwf23m53a432651ylvk8qnjlmj43blxgiwrs5",
"url": "https://github.com/input-output-hk/nixpkgs",
"rev": "a8f81dc037a5977414a356dd068f2621b3c89b60",
"date": "2019-10-17T21:54:56+08:00",
"sha256": "01z13axll5g5yl00lz9adr2jw2bs12g9skhbb1vxy8p7fjjbhhhm",
"fetchSubmodules": false
}

View File

@ -0,0 +1,7 @@
{
"url": "https://github.com/input-output-hk/nixpkgs",
"rev": "31aa5316ca232a53667790a99e8b1e76252e065c",
"date": "2019-11-16T23:51:02+13:00",
"sha256": "0g0r473rdrh5vsdvr45nmfs6ibp0pqyzbw9f0iv6r0jkg6jjiykr",
"fetchSubmodules": false
}

View File

@ -365,20 +365,23 @@ self: super: {
inherit derivation;
inputs = builtins.listToAttrs (
builtins.concatMap (i: if i == null then [] else [
{ name = builtins.replaceStrings ["."] ["_"] i.name; value = i; }
{ name = builtins.replaceStrings ["." (self.stdenv.hostPlatform.config + "-")] ["_" ""] i.name; value = i; }
]) derivation.nativeBuildInputs);
};
# Add this to your tests to make all the dependencies of haskell.nix
# are tested and cached.
haskellNixRoots = self.recurseIntoAttrs (builtins.mapAttrs (_: self.recurseIntoAttrs) {
inherit (self.haskell-nix) nix-tools source-pins;
bootstap-nix-tools = self.haskell-nix.bootstrap.packages.nix-tools;
alex-plan-nix = withInputs self.haskell-nix.bootstrap.packages.alex-project.plan-nix;
happy-plan-nix = withInputs self.haskell-nix.bootstrap.packages.happy-project.plan-nix;
hscolour-plan-nix = withInputs self.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
inherit (self.buildPackages.haskell-nix) nix-tools source-pins;
bootstap-nix-tools = self.buildPackages.haskell-nix.bootstrap.packages.nix-tools;
alex-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.alex-project.plan-nix;
happy-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.happy-project.plan-nix;
hscolour-plan-nix = withInputs self.buildPackages.haskell-nix.bootstrap.packages.hscolour-project.plan-nix;
ghc-extra-projects = builtins.mapAttrs (_: proj: self.recurseIntoAttrs (withInputs proj.plan-nix))
(self.lib.filterAttrs (n: _: n != "ghc844" && n != "ghc861" && n != "ghc862") self.ghc-extra-projects);
(self.lib.filterAttrs (n: _: n != "ghc844" && n != "ghc861" && n != "ghc862"
# There is an issue with GHC 8.6.4 and nixpkgs 19.09, so only build it for 19.03 for now
&& (n != "ghc864" || super.lib.versions.majorMinor super.lib.version == "19.03")
) self.ghc-extra-projects);
});
};
}

View File

@ -4,13 +4,8 @@
, nixpkgsArgs ? {}
}:
let fixedNixpkgs = import ./nixpkgs {}; in
with fixedNixpkgs.lib;
with (import (fixedNixpkgs.path + "/pkgs/top-level/release-lib.nix") {
inherit supportedSystems scrubJobs nixpkgsArgs;
packageSet = import (haskell-nix + /build.nix);
});
let defaultNixpkgs = import ./nixpkgs {}; in
with defaultNixpkgs.lib;
let
# Remove tests which have meta.disabled = true
filterTests = let
@ -20,20 +15,49 @@ let
tests = filterAttrs (_: nonEmpty) (mapAttrs (name: removeDisabled) jobs.tests);
};
inherit (systems.examples) musl64;
jobs = nixpkgs-pin:
# Now we know what nixpkgs-pin we are testing use that one.
# This fixes and issue where the vendor has changed from `x86_64-pc-mingw32`
# to `x86_64-w64-mingw32` in 19.09.
let pinnedNixpkgs = import ./nixpkgs { inherit nixpkgs-pin; }; in
with pinnedNixpkgs.lib;
let inherit (systems.examples) musl64 mingwW64; in
with (import (pinnedNixpkgs.path + "/pkgs/top-level/release-lib.nix") {
inherit supportedSystems scrubJobs nixpkgsArgs;
packageSet = {
system ? builtins.currentSystem
, crossSystem ? null
, nixpkgsArgs ? { inherit system crossSystem; }
, ...}@args:
import (haskell-nix + /build.nix) (args // {
nixpkgsArgs = nixpkgsArgs // { inherit nixpkgs-pin; };
});
});
jobs = {
native = filterTests (mapTestOn (packagePlatforms pkgs));
# Disabled for now. Something is wrong and this would require `allowBroken`
# "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
} // {
{
native = filterTests (mapTestOn (packagePlatforms pkgs));
# Disabled for now. Something is wrong and this would require `allowBroken`
# "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
} // (optionalAttrs (nixpkgs-pin == "release-19.03") {
"${mingwW64.config}" = filterTests (mapTestOnCross mingwW64 (packagePlatforms pkgs));
});
allJobs =
builtins.mapAttrs (_: nixpkgs-pin: jobs nixpkgs-pin) {
"R1903" = "release-19.03";
"R1909" = "release-19.09";
};
in allJobs // {
# On IOHK Hydra, "required" is a special job that updates the
# GitHub CI status.
required = fixedNixpkgs.releaseTools.aggregate {
required = defaultNixpkgs.releaseTools.aggregate {
name = "haskell.nix-required";
meta.description = "All jobs required to pass CI";
constituents = collect isDerivation jobs.native;
constituents =
collect isDerivation allJobs.R1903.native
++ collect isDerivation allJobs.R1909.native;
};
};
}
in jobs

View File

@ -1,28 +1,25 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, cabalProject', haskellLib, recurseIntoAttrs }:
with stdenv.lib;
let
plan = importAndFilterProject (callCabalProjectToNix {
project = cabalProject' {
name = "test-buildable";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
});
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = plan.pkgs;
src = haskellLib.cleanGit { src = ../..; subDir = "test/buildable"; };
modules = [ { packages.buildable-test.flags.exclude-broken = true; } ];
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "buildable-test";
buildCommand =
(concatStrings (mapAttrsToList (name: value: ''
exe="${value}/bin/${name}"
printf "checking whether executable runs... " >& 2
$exe
cat ${value.run}
'') packages.buildable-test.components.exes)) + ''
touch $out
'';
@ -31,7 +28,7 @@ in
passthru = {
# Attributes used for debugging with nix repl
inherit pkgSet packages;
inherit (plan) nix;
inherit project packages;
};
}
};
}

View File

@ -35,7 +35,12 @@ in
buildCommand = let
inherit (packages.test-haddock.components) library;
noDocLibrary = packages.stm.components.library;
in ''
in if (stdenv.hostPlatform != stdenv.buildPlatform)
then ''
echo "Skipping haddock tests when cross compiling" >& 2
touch $out
''
else ''
########################################################################
# test haddock

View File

@ -1,94 +0,0 @@
let
buildDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (build dependency).
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.
'';
sysDepError = pkg:
builtins.throw ''
The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
You may need to augment the system package mapping in haskell.nix so that it can be found.
'';
pkgConfDepError = pkg:
builtins.throw ''
The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
'';
exeDepError = pkg:
builtins.throw ''
The local executable components do not include the component: ${pkg} (executable dependency).
'';
legacyExeDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (executable dependency).
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.
'';
buildToolDepError = pkg:
builtins.throw ''
Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
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.
'';
in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = {};
package = {
specVersion = "2.2";
identifier = { name = "project"; version = "0.1.0.0"; };
license = "NONE";
copyright = "";
maintainer = "rodney.lorrimar@iohk.io";
author = "Rodney Lorrimar";
homepage = "";
url = "";
synopsis = "";
description = "";
buildType = "Simple";
isLocal = true;
};
components = {
"library" = {
depends = [ (hsPkgs."base" or (buildDepError "base")) ];
buildable = true;
};
exes = {
"project" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
];
buildable = true;
};
};
tests = {
"unit" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
(hsPkgs."hspec" or (buildDepError "hspec"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (buildToolDepError "hspec-discover")))
];
buildable = true;
};
};
benchmarks = {
"project-bench" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
];
buildable = true;
};
};
};
} // rec { src = (pkgs.lib).mkDefault ../.; }

View File

@ -1,20 +1,23 @@
{ stdenv, mkCabalProjectPkgSet, util }:
{ stdenv, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs }:
with stdenv.lib;
let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = import ./pkgs.nix;
project = cabalProject' {
name = "cabal-22";
src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-22"; };
};
packages = pkgSet.config.hsPkgs;
packages = project.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
inherit (project) plan-nix;
shell = util.addCabalInstall packages.project.components.all;
run = stdenv.mkDerivation {
name = "cabal-22-test";
buildCommand = ''
exe="${packages.project.components.exes.project}/bin/project"
exe="${packages.project.components.exes.project}/bin/project${stdenv.hostPlatform.extensions.executable}"
size=$(command stat --format '%s' "$exe")
printf "size of executable $exe is $size. \n" >& 2
@ -56,6 +59,6 @@ in
meta.platforms = platforms.all;
passthru = {
inherit (packages) project;
shell = util.addCabalInstall packages.project.components.all;
};
}
};
}

View File

@ -1,74 +0,0 @@
{
pkgs = hackage:
{
packages = {
"tf-random".revision = (((hackage."tf-random")."0.5").revisions).default;
"ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
"stm".revision = (((hackage."stm")."2.5.0.0").revisions).default;
"unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
"rts".revision = (((hackage."rts")."1.0").revisions).default;
"clock".revision = (((hackage."clock")."0.8").revisions).default;
"clock".flags.llvm = false;
"QuickCheck".revision = (((hackage."QuickCheck")."2.13.2").revisions).default;
"QuickCheck".flags.templatehaskell = true;
"hspec-discover".revision = (((hackage."hspec-discover")."2.7.1").revisions).default;
"deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
"random".revision = (((hackage."random")."1.1").revisions).default;
"splitmix".revision = (((hackage."splitmix")."0.0.3").revisions).default;
"splitmix".flags.optimised-mixer = false;
"splitmix".flags.random = true;
"HUnit".revision = (((hackage."HUnit")."1.6.0.0").revisions).default;
"directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
"template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
"hspec-expectations".revision = (((hackage."hspec-expectations")."0.8.2").revisions).default;
"call-stack".revision = (((hackage."call-stack")."0.2.0").revisions).default;
"primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
"ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
"ansi-terminal".flags.example = false;
"containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
"bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
"setenv".revision = (((hackage."setenv")."0.1.1.3").revisions).default;
"base".revision = (((hackage."base")."4.12.0.0").revisions).default;
"hspec".revision = (((hackage."hspec")."2.7.1").revisions).default;
"time".revision = (((hackage."time")."1.8.0.2").revisions).default;
"transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
"quickcheck-io".revision = (((hackage."quickcheck-io")."0.2.0").revisions).default;
"colour".revision = (((hackage."colour")."2.3.5").revisions).default;
"filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
"hspec-core".revision = (((hackage."hspec-core")."2.7.1").revisions).default;
"pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
"ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
"array".revision = (((hackage."array")."0.5.3.0").revisions).default;
"integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
};
compiler = {
version = "8.6.5";
nix-name = "ghc865";
packages = {
"ghc-prim" = "0.5.3";
"stm" = "2.5.0.0";
"unix" = "2.7.2.2";
"rts" = "1.0";
"deepseq" = "1.4.4.0";
"directory" = "1.3.3.0";
"template-haskell" = "2.14.0.0";
"containers" = "0.6.0.1";
"bytestring" = "0.10.8.2";
"base" = "4.12.0.0";
"time" = "1.8.0.2";
"transformers" = "0.5.6.2";
"filepath" = "1.4.2.1";
"pretty" = "1.1.3.6";
"ghc-boot-th" = "8.6.5";
"array" = "0.5.3.0";
"integer-gmp" = "1.0.2.0";
};
};
};
extras = hackage:
{ packages = { project = ./.plan.nix/project.nix; }; };
modules = [
({ lib, ... }:
{ packages = { "project" = { flags = {}; }; }; })
];
}

View File

@ -1,93 +0,0 @@
let
buildDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (build dependency).
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.
'';
sysDepError = pkg:
builtins.throw ''
The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
You may need to augment the system package mapping in haskell.nix so that it can be found.
'';
pkgConfDepError = pkg:
builtins.throw ''
The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
'';
exeDepError = pkg:
builtins.throw ''
The local executable components do not include the component: ${pkg} (executable dependency).
'';
legacyExeDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (executable dependency).
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.
'';
buildToolDepError = pkg:
builtins.throw ''
Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
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.
'';
in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = {};
package = {
specVersion = "2.2";
identifier = { name = "project"; version = "0.1.0.0"; };
license = "NONE";
copyright = "";
maintainer = "rodney.lorrimar@iohk.io";
author = "Rodney Lorrimar";
homepage = "";
url = "";
synopsis = "";
description = "";
buildType = "Simple";
};
components = {
"library" = {
depends = [ (hsPkgs."base" or (buildDepError "base")) ];
buildable = true;
};
exes = {
"project" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
];
buildable = true;
};
};
tests = {
"unit" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
(hsPkgs."hspec" or (buildDepError "hspec"))
];
build-tools = [
(hsPkgs.buildPackages.hspec-discover or (pkgs.buildPackages.hspec-discover or (buildToolDepError "hspec-discover")))
];
buildable = true;
};
};
benchmarks = {
"project-bench" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."project" or (buildDepError "project"))
];
buildable = true;
};
};
};
} // rec { src = (pkgs.lib).mkDefault ./.; }

View File

@ -1,32 +0,0 @@
{ system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = {};
package = {
specVersion = "1.10";
identifier = { name = "cabal-simple"; version = "0.1.0.0"; };
license = "LicenseRef-PublicDomain";
copyright = "";
maintainer = "rodney.lorrimar@iohk.io";
author = "Rodney Lorrimar";
homepage = "";
url = "";
synopsis = "";
description = "";
buildType = "Simple";
};
components = {
"library" = {
depends = [ (hsPkgs.base) (hsPkgs.extra) (hsPkgs.safe) (hsPkgs.aeson) ];
};
exes = {
"cabal-simple" = {
depends = [
(hsPkgs.base)
(hsPkgs.cabal-simple)
(hsPkgs.extra)
(hsPkgs.optparse-applicative)
];
};
};
};
} // rec { src = (pkgs.lib).mkDefault ../.; }

View File

@ -1,38 +1,42 @@
# Test a package set
{ stdenv, util, mkCabalProjectPkgSet }:
{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs }:
with stdenv.lib;
let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = import ./pkgs.nix;
modules = [
{
# Package has no exposed modules which causes
# haddock: No input file(s)
packages.cabal-simple.doHaddock = false;
packages.cabal-simple.enableExecutableProfiling = true;
enableLibraryProfiling = true;
# executableProfiling = false;
}
];
modules = [
{
# Package has no exposed modules which causes
# haddock: No input file(s)
packages.cabal-simple.doHaddock = false;
packages.cabal-simple.enableExecutableProfiling = true;
enableLibraryProfiling = true;
# executableProfiling = false;
}
];
project = cabalProject' {
name = "cabal-simple-prof";
src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-simple-prof"; };
inherit modules;
};
packages = pkgSet.config.hsPkgs;
packages = project.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "cabal-simple-prof-test";
buildCommand = ''
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
size=$(command stat --format '%s' "$exe")
printf "size of executable $exe is $size. \n" >& 2
# fixme: run on target platform when cross-compiled
printf "checking whether executable runs with profiling... " >& 2
$exe +RTS -p -h
${toString packages.cabal-simple.components.exes.cabal-simple.config.testWrapper} $exe +RTS -p -h
touch $out
'';
@ -41,10 +45,11 @@ in
passthru = {
# Used for debugging with nix repl
inherit pkgSet packages;
inherit project packages;
# Used for testing externally with nix-shell (../tests.sh).
# This just adds cabal-install to the existing shells.
test-shell = util.addCabalInstall packages.cabal-simple.components.all;
};
};
}

View File

@ -1,124 +0,0 @@
{
pkgs = hackage:
{
packages = {
"binary".revision = (((hackage."binary")."0.8.5.1").revisions).default;
"ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default;
"extra".revision = (((hackage."extra")."1.6.15").revisions).default;
"stm".revision = (((hackage."stm")."2.4.5.1").revisions).default;
"unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
"rts".revision = (((hackage."rts")."1.0").revisions).default;
"clock".revision = (((hackage."clock")."0.8").revisions).default;
"clock".flags.llvm = false;
"scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
"scientific".flags.integer-simple = false;
"scientific".flags.bytestring-builder = false;
"deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default;
"random".revision = (((hackage."random")."1.1").revisions).default;
"uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
"optparse-applicative".revision = (((hackage."optparse-applicative")."0.14.3.0").revisions).default;
"dlist".revision = (((hackage."dlist")."0.8.0.6").revisions).default;
"semigroups".revision = (((hackage."semigroups")."0.19").revisions).default;
"semigroups".flags.bytestring = true;
"semigroups".flags.unordered-containers = true;
"semigroups".flags.text = true;
"semigroups".flags.tagged = true;
"semigroups".flags.containers = true;
"semigroups".flags.binary = true;
"semigroups".flags.hashable = true;
"semigroups".flags.transformers = true;
"semigroups".flags.deepseq = true;
"semigroups".flags.bytestring-builder = false;
"semigroups".flags.template-haskell = true;
"directory".revision = (((hackage."directory")."1.3.1.5").revisions).default;
"transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
"transformers-compat".flags.five = false;
"transformers-compat".flags.generic-deriving = true;
"transformers-compat".flags.two = false;
"transformers-compat".flags.five-three = true;
"transformers-compat".flags.mtl = true;
"transformers-compat".flags.four = false;
"transformers-compat".flags.three = false;
"template-haskell".revision = (((hackage."template-haskell")."2.13.0.0").revisions).default;
"vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
"vector".flags.unsafechecks = false;
"vector".flags.internalchecks = false;
"vector".flags.wall = false;
"vector".flags.boundschecks = true;
"primitive".revision = (((hackage."primitive")."0.6.4.0").revisions).default;
"time-locale-compat".revision = (((hackage."time-locale-compat")."0.1.1.5").revisions).default;
"time-locale-compat".flags.old-locale = false;
"safe".revision = (((hackage."safe")."0.3.17").revisions).default;
"base-compat".revision = (((hackage."base-compat")."0.10.5").revisions).default;
"ansi-terminal".revision = (((hackage."ansi-terminal")."0.9.1").revisions).default;
"ansi-terminal".flags.example = false;
"tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
"tagged".flags.transformers = true;
"tagged".flags.deepseq = true;
"containers".revision = (((hackage."containers")."0.5.11.0").revisions).default;
"integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
"integer-logarithms".flags.check-bounds = false;
"integer-logarithms".flags.integer-gmp = true;
"bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
"ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
"ansi-wl-pprint".flags.example = false;
"StateVar".revision = (((hackage."StateVar")."1.1.1.1").revisions).default;
"contravariant".revision = (((hackage."contravariant")."1.5.1").revisions).default;
"contravariant".flags.semigroups = true;
"contravariant".flags.tagged = true;
"contravariant".flags.statevar = true;
"text".revision = (((hackage."text")."1.2.3.1").revisions).default;
"unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
"unordered-containers".flags.debug = false;
"base".revision = (((hackage."base")."4.11.1.0").revisions).default;
"time".revision = (((hackage."time")."1.8.0.2").revisions).default;
"transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
"hashable".revision = (((hackage."hashable")."1.2.7.0").revisions).default;
"hashable".flags.sse2 = true;
"hashable".flags.integer-gmp = true;
"hashable".flags.sse41 = false;
"hashable".flags.examples = false;
"attoparsec".revision = (((hackage."attoparsec")."0.13.2.2").revisions).default;
"attoparsec".flags.developer = false;
"colour".revision = (((hackage."colour")."2.3.5").revisions).default;
"filepath".revision = (((hackage."filepath")."1.4.2").revisions).default;
"process".revision = (((hackage."process")."1.6.5.0").revisions).default;
"pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
"aeson".revision = (((hackage."aeson")."1.4.3.0").revisions).default;
"aeson".flags.cffi = false;
"aeson".flags.fast = false;
"aeson".flags.bytestring-builder = false;
"aeson".flags.developer = false;
"ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.4.4").revisions).default;
"th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
"array".revision = (((hackage."array")."0.5.2.0").revisions).default;
"integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
};
compiler = {
version = "8.4.4";
nix-name = "ghc844";
packages = {
"binary" = "0.8.5.1";
"ghc-prim" = "0.5.2.0";
"stm" = "2.4.5.1";
"unix" = "2.7.2.2";
"rts" = "1.0";
"deepseq" = "1.4.3.0";
"directory" = "1.3.1.5";
"template-haskell" = "2.13.0.0";
"containers" = "0.5.11.0";
"bytestring" = "0.10.8.2";
"text" = "1.2.3.1";
"base" = "4.11.1.0";
"time" = "1.8.0.2";
"filepath" = "1.4.2";
"pretty" = "1.1.3.6";
"ghc-boot-th" = "8.4.4";
"array" = "0.5.2.0";
"integer-gmp" = "1.0.2.0";
};
};
};
extras = hackage:
{ packages = { cabal-simple = ./.plan.nix/cabal-simple.nix; }; };
}

View File

@ -1,79 +0,0 @@
let
buildDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (build dependency).
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.
'';
sysDepError = pkg:
builtins.throw ''
The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
You may need to augment the system package mapping in haskell.nix so that it can be found.
'';
pkgConfDepError = pkg:
builtins.throw ''
The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
'';
exeDepError = pkg:
builtins.throw ''
The local executable components do not include the component: ${pkg} (executable dependency).
'';
legacyExeDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (executable dependency).
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.
'';
buildToolDepError = pkg:
builtins.throw ''
Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
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.
'';
in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = {};
package = {
specVersion = "1.10";
identifier = { name = "cabal-simple"; version = "0.1.0.0"; };
license = "LicenseRef-PublicDomain";
copyright = "";
maintainer = "rodney.lorrimar@iohk.io";
author = "Rodney Lorrimar";
homepage = "";
url = "";
synopsis = "";
description = "";
buildType = "Simple";
isLocal = true;
};
components = {
"library" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."extra" or (buildDepError "extra"))
(hsPkgs."safe" or (buildDepError "safe"))
(hsPkgs."aeson" or (buildDepError "aeson"))
];
buildable = true;
};
exes = {
"cabal-simple" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."cabal-simple" or (buildDepError "cabal-simple"))
(hsPkgs."extra" or (buildDepError "extra"))
(hsPkgs."optparse-applicative" or (buildDepError "optparse-applicative"))
];
buildable = true;
};
};
};
} // rec { src = (pkgs.lib).mkDefault ../.; }

View File

@ -1,12 +1,10 @@
# Test a package set
{ stdenv, util, mkCabalProjectPkgSet, gmp6, zlib }:
{ stdenv, util, mkCabalProjectPkgSet, cabalProject', haskellLib, gmp6, zlib, recurseIntoAttrs }:
with stdenv.lib;
let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = import ./pkgs.nix;
modules = [
modules = [
{
# Package has no exposed modules which causes
# haddock: No input file(s)
@ -25,24 +23,35 @@ let
# "--ghc-option=-optl=-L${zlib.static}/lib"
];
}
];
];
project = cabalProject' {
name = "cabal-simple";
src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-simple"; };
inherit modules;
};
packages = pkgSet.config.hsPkgs;
packages = project.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
inherit (project) plan-nix;
# Used for testing externally with nix-shell (../tests.sh).
# This just adds cabal-install to the existing shells.
test-shell = util.addCabalInstall packages.cabal-simple.components.all;
run = stdenv.mkDerivation {
name = "cabal-simple-test";
buildCommand = ''
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
size=$(command stat --format '%s' "$exe")
printf "size of executable $exe is $size. \n" >& 2
# fixme: run on target platform when cross-compiled
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.cabal-simple.components.exes.cabal-simple.run}
'' + (if stdenv.hostPlatform.isMusl then ''
printf "checking that executable is statically linked... " >& 2
(ldd $exe 2>&1 || true) | grep -i "not a"
@ -55,7 +64,7 @@ in
'') + ''
printf "Checking that \"all\" component has the programs... " >& 2
all_exe="${packages.cabal-simple.components.all}/bin/cabal-simple"
all_exe="${packages.cabal-simple.components.all}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
test -f "$all_exe"
echo "$all_exe" >& 2
@ -66,10 +75,7 @@ in
passthru = {
# Used for debugging with nix repl
inherit pkgSet packages;
# Used for testing externally with nix-shell (../tests.sh).
# This just adds cabal-install to the existing shells.
test-shell = util.addCabalInstall packages.cabal-simple.components.all;
inherit project packages;
};
};
}

View File

@ -1,124 +0,0 @@
{
pkgs = hackage:
{
packages = {
"binary".revision = (((hackage."binary")."0.8.6.0").revisions).default;
"ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
"extra".revision = (((hackage."extra")."1.6.18").revisions).default;
"unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
"rts".revision = (((hackage."rts")."1.0").revisions).default;
"clock".revision = (((hackage."clock")."0.8").revisions).default;
"clock".flags.llvm = false;
"scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
"scientific".flags.integer-simple = false;
"scientific".flags.bytestring-builder = false;
"deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
"random".revision = (((hackage."random")."1.1").revisions).default;
"uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
"optparse-applicative".revision = (((hackage."optparse-applicative")."0.15.1.0").revisions).default;
"dlist".revision = (((hackage."dlist")."0.8.0.7").revisions).default;
"semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default;
"semigroups".flags.bytestring = true;
"semigroups".flags.unordered-containers = true;
"semigroups".flags.text = true;
"semigroups".flags.tagged = true;
"semigroups".flags.containers = true;
"semigroups".flags.binary = true;
"semigroups".flags.hashable = true;
"semigroups".flags.transformers = true;
"semigroups".flags.deepseq = true;
"semigroups".flags.bytestring-builder = false;
"semigroups".flags.template-haskell = true;
"directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
"transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
"transformers-compat".flags.five = false;
"transformers-compat".flags.generic-deriving = true;
"transformers-compat".flags.two = false;
"transformers-compat".flags.five-three = true;
"transformers-compat".flags.mtl = true;
"transformers-compat".flags.four = false;
"transformers-compat".flags.three = false;
"template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
"vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
"vector".flags.unsafechecks = false;
"vector".flags.internalchecks = false;
"vector".flags.wall = false;
"vector".flags.boundschecks = true;
"primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
"safe".revision = (((hackage."safe")."0.3.17").revisions).default;
"base-compat".revision = (((hackage."base-compat")."0.11.0").revisions).default;
"time-compat".revision = (((hackage."time-compat")."1.9.2.2").revisions).default;
"time-compat".flags.old-locale = false;
"ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
"ansi-terminal".flags.example = false;
"tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
"tagged".flags.transformers = true;
"tagged".flags.deepseq = true;
"containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
"integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
"integer-logarithms".flags.check-bounds = false;
"integer-logarithms".flags.integer-gmp = true;
"bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
"ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
"ansi-wl-pprint".flags.example = false;
"text".revision = (((hackage."text")."1.2.3.1").revisions).default;
"unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
"unordered-containers".flags.debug = false;
"base".revision = (((hackage."base")."4.12.0.0").revisions).default;
"time".revision = (((hackage."time")."1.8.0.2").revisions).default;
"transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
"hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default;
"hashable".flags.sse2 = true;
"hashable".flags.integer-gmp = true;
"hashable".flags.sse41 = false;
"hashable".flags.examples = false;
"attoparsec".revision = (((hackage."attoparsec")."0.13.2.3").revisions).default;
"attoparsec".flags.developer = false;
"colour".revision = (((hackage."colour")."2.3.5").revisions).default;
"filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
"process".revision = (((hackage."process")."1.6.5.0").revisions).default;
"pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
"aeson".revision = (((hackage."aeson")."1.4.5.0").revisions).default;
"aeson".flags.cffi = false;
"aeson".flags.fast = false;
"aeson".flags.bytestring-builder = false;
"aeson".flags.developer = false;
"ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
"base-orphans".revision = (((hackage."base-orphans")."0.8.1").revisions).default;
"th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
"array".revision = (((hackage."array")."0.5.3.0").revisions).default;
"integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
};
compiler = {
version = "8.6.5";
nix-name = "ghc865";
packages = {
"binary" = "0.8.6.0";
"ghc-prim" = "0.5.3";
"unix" = "2.7.2.2";
"rts" = "1.0";
"deepseq" = "1.4.4.0";
"directory" = "1.3.3.0";
"template-haskell" = "2.14.0.0";
"containers" = "0.6.0.1";
"bytestring" = "0.10.8.2";
"text" = "1.2.3.1";
"base" = "4.12.0.0";
"time" = "1.8.0.2";
"transformers" = "0.5.6.2";
"filepath" = "1.4.2.1";
"process" = "1.6.5.0";
"pretty" = "1.1.3.6";
"ghc-boot-th" = "8.6.5";
"array" = "0.5.3.0";
"integer-gmp" = "1.0.2.0";
};
};
};
extras = hackage:
{ packages = { cabal-simple = ./.plan.nix/cabal-simple.nix; }; };
modules = [
({ lib, ... }:
{ packages = { "cabal-simple" = { flags = {}; }; }; })
];
}

View File

@ -1,26 +1,24 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, cabalProject', recurseIntoAttrs }:
with stdenv.lib;
let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = (importAndFilterProject (callCabalProjectToNix {
name = "test-cabal-source-repo";
index-state = "2019-04-30T00:00:00Z";
# reuse the cabal-simple test project
src = ./.;
})).pkgs;
project = cabalProject' {
name = "test-cabal-source-repo";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";
buildCommand = ''
exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple"
exe="${packages.use-cabal-simple.components.exes.use-cabal-simple}/bin/use-cabal-simple${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.use-cabal-simple.components.exes.use-cabal-simple.run}
touch $out
'';
@ -31,4 +29,5 @@ in
# Attributes used for debugging with nix repl
inherit pkgSet packages;
};
}
};
}

View File

@ -1,87 +0,0 @@
let
buildDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (build dependency).
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.
'';
sysDepError = pkg:
builtins.throw ''
The Nixpkgs package set does not contain the package: ${pkg} (system dependency).
You may need to augment the system package mapping in haskell.nix so that it can be found.
'';
pkgConfDepError = pkg:
builtins.throw ''
The pkg-conf packages does not contain the package: ${pkg} (pkg-conf dependency).
You may need to augment the pkg-conf package mapping in haskell.nix so that it can be found.
'';
exeDepError = pkg:
builtins.throw ''
The local executable components do not include the component: ${pkg} (executable dependency).
'';
legacyExeDepError = pkg:
builtins.throw ''
The Haskell package set does not contain the package: ${pkg} (executable dependency).
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.
'';
buildToolDepError = pkg:
builtins.throw ''
Neither the Haskell package set or the Nixpkgs package set contain the package: ${pkg} (build tool dependency).
If this is a system dependency:
You may need to augment the system package mapping in haskell.nix so that it can be found.
If this is a Haskell dependency:
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.
'';
in { system, compiler, flags, pkgs, hsPkgs, pkgconfPkgs, ... }:
{
flags = {};
package = {
specVersion = "2.2";
identifier = { name = "cabal-sublib"; version = "0.1.0.0"; };
license = "MIT";
copyright = "";
maintainer = "moritz.angermann@iohk.io";
author = "Moritz Angermann";
homepage = "";
url = "";
synopsis = "";
description = "";
buildType = "Simple";
isLocal = true;
};
components = {
"library" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."slib" or (buildDepError "slib"))
];
buildable = true;
};
sublibs = {
"slib" = {
depends = [
(hsPkgs."extra" or (buildDepError "extra"))
(hsPkgs."safe" or (buildDepError "safe"))
(hsPkgs."aeson" or (buildDepError "aeson"))
];
buildable = true;
};
};
exes = {
"cabal-sublib" = {
depends = [
(hsPkgs."base" or (buildDepError "base"))
(hsPkgs."cabal-sublib" or (buildDepError "cabal-sublib"))
(hsPkgs."extra" or (buildDepError "extra"))
(hsPkgs."optparse-applicative" or (buildDepError "optparse-applicative"))
];
buildable = true;
};
};
};
} // rec { src = (pkgs.lib).mkDefault ../.; }

View File

@ -1,35 +1,40 @@
# Test a package set
{ stdenv, util, mkCabalProjectPkgSet }:
{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs }:
with stdenv.lib;
let
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = import ./pkgs.nix;
modules = [
{
# Package has no exposed modules which causes
# haddock: No input file(s)
packages.cabal-sublib.doHaddock = false;
}
];
modules = [
{
# Package has no exposed modules which causes
# haddock: No input file(s)
packages.cabal-sublib.doHaddock = false;
}
];
# The ./pkgs.nix works for linux & darwin, but not for windows
project = cabalProject' {
name = "cabal-sublib";
src = haskellLib.cleanGit { src = ../..; subDir = "test/cabal-sublib"; };
inherit modules;
};
packages = pkgSet.config.hsPkgs;
packages = project.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "cabal-sublib-test";
buildCommand = ''
exe="${packages.cabal-sublib.components.exes.cabal-sublib}/bin/cabal-sublib"
exe="${packages.cabal-sublib.components.exes.cabal-sublib}/bin/cabal-sublib${stdenv.hostPlatform.extensions.executable}"
size=$(command stat --format '%s' "$exe")
printf "size of executable $exe is $size. \n" >& 2
# fixme: run on target platform when cross-compiled
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.cabal-sublib.components.exes.cabal-sublib.run}
printf "checking that executable is dynamically linked to system libraries... " >& 2
'' + optionalString stdenv.isLinux ''
@ -39,7 +44,7 @@ in
'' + ''
printf "Checking that \"all\" component has the programs... " >& 2
all_exe="${packages.cabal-sublib.components.all}/bin/cabal-sublib"
all_exe="${packages.cabal-sublib.components.all}/bin/cabal-sublib${stdenv.hostPlatform.extensions.executable}"
test -f "$all_exe"
echo "$all_exe" >& 2
@ -56,4 +61,5 @@ in
# This just adds cabal-install to the existing shells.
test-shell = util.addCabalInstall packages.cabal-sublib.components.all;
};
};
}

View File

@ -1,124 +0,0 @@
{
pkgs = hackage:
{
packages = {
"binary".revision = (((hackage."binary")."0.8.6.0").revisions).default;
"ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default;
"extra".revision = (((hackage."extra")."1.6.18").revisions).default;
"unix".revision = (((hackage."unix")."2.7.2.2").revisions).default;
"rts".revision = (((hackage."rts")."1.0").revisions).default;
"clock".revision = (((hackage."clock")."0.8").revisions).default;
"clock".flags.llvm = false;
"scientific".revision = (((hackage."scientific")."0.3.6.2").revisions).default;
"scientific".flags.integer-simple = false;
"scientific".flags.bytestring-builder = false;
"deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default;
"random".revision = (((hackage."random")."1.1").revisions).default;
"uuid-types".revision = (((hackage."uuid-types")."1.0.3").revisions).default;
"optparse-applicative".revision = (((hackage."optparse-applicative")."0.15.1.0").revisions).default;
"dlist".revision = (((hackage."dlist")."0.8.0.7").revisions).default;
"semigroups".revision = (((hackage."semigroups")."0.19.1").revisions).default;
"semigroups".flags.bytestring = true;
"semigroups".flags.unordered-containers = true;
"semigroups".flags.text = true;
"semigroups".flags.tagged = true;
"semigroups".flags.containers = true;
"semigroups".flags.binary = true;
"semigroups".flags.hashable = true;
"semigroups".flags.transformers = true;
"semigroups".flags.deepseq = true;
"semigroups".flags.bytestring-builder = false;
"semigroups".flags.template-haskell = true;
"directory".revision = (((hackage."directory")."1.3.3.0").revisions).default;
"transformers-compat".revision = (((hackage."transformers-compat")."0.6.5").revisions).default;
"transformers-compat".flags.five = false;
"transformers-compat".flags.generic-deriving = true;
"transformers-compat".flags.two = false;
"transformers-compat".flags.five-three = true;
"transformers-compat".flags.mtl = true;
"transformers-compat".flags.four = false;
"transformers-compat".flags.three = false;
"template-haskell".revision = (((hackage."template-haskell")."2.14.0.0").revisions).default;
"vector".revision = (((hackage."vector")."0.12.0.3").revisions).default;
"vector".flags.unsafechecks = false;
"vector".flags.internalchecks = false;
"vector".flags.wall = false;
"vector".flags.boundschecks = true;
"primitive".revision = (((hackage."primitive")."0.7.0.0").revisions).default;
"safe".revision = (((hackage."safe")."0.3.17").revisions).default;
"base-compat".revision = (((hackage."base-compat")."0.11.0").revisions).default;
"time-compat".revision = (((hackage."time-compat")."1.9.2.2").revisions).default;
"time-compat".flags.old-locale = false;
"ansi-terminal".revision = (((hackage."ansi-terminal")."0.10.1").revisions).default;
"ansi-terminal".flags.example = false;
"tagged".revision = (((hackage."tagged")."0.8.6").revisions).default;
"tagged".flags.transformers = true;
"tagged".flags.deepseq = true;
"containers".revision = (((hackage."containers")."0.6.0.1").revisions).default;
"integer-logarithms".revision = (((hackage."integer-logarithms")."1.0.3").revisions).default;
"integer-logarithms".flags.check-bounds = false;
"integer-logarithms".flags.integer-gmp = true;
"bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default;
"ansi-wl-pprint".revision = (((hackage."ansi-wl-pprint")."0.6.9").revisions).default;
"ansi-wl-pprint".flags.example = false;
"text".revision = (((hackage."text")."1.2.3.1").revisions).default;
"unordered-containers".revision = (((hackage."unordered-containers")."0.2.10.0").revisions).default;
"unordered-containers".flags.debug = false;
"base".revision = (((hackage."base")."4.12.0.0").revisions).default;
"time".revision = (((hackage."time")."1.8.0.2").revisions).default;
"transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default;
"hashable".revision = (((hackage."hashable")."1.3.0.0").revisions).default;
"hashable".flags.sse2 = true;
"hashable".flags.integer-gmp = true;
"hashable".flags.sse41 = false;
"hashable".flags.examples = false;
"attoparsec".revision = (((hackage."attoparsec")."0.13.2.3").revisions).default;
"attoparsec".flags.developer = false;
"colour".revision = (((hackage."colour")."2.3.5").revisions).default;
"filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default;
"process".revision = (((hackage."process")."1.6.5.0").revisions).default;
"pretty".revision = (((hackage."pretty")."1.1.3.6").revisions).default;
"aeson".revision = (((hackage."aeson")."1.4.5.0").revisions).default;
"aeson".flags.cffi = false;
"aeson".flags.fast = false;
"aeson".flags.bytestring-builder = false;
"aeson".flags.developer = false;
"ghc-boot-th".revision = (((hackage."ghc-boot-th")."8.6.5").revisions).default;
"base-orphans".revision = (((hackage."base-orphans")."0.8.1").revisions).default;
"th-abstraction".revision = (((hackage."th-abstraction")."0.3.1.0").revisions).default;
"array".revision = (((hackage."array")."0.5.3.0").revisions).default;
"integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default;
};
compiler = {
version = "8.6.5";
nix-name = "ghc865";
packages = {
"binary" = "0.8.6.0";
"ghc-prim" = "0.5.3";
"unix" = "2.7.2.2";
"rts" = "1.0";
"deepseq" = "1.4.4.0";
"directory" = "1.3.3.0";
"template-haskell" = "2.14.0.0";
"containers" = "0.6.0.1";
"bytestring" = "0.10.8.2";
"text" = "1.2.3.1";
"base" = "4.12.0.0";
"time" = "1.8.0.2";
"transformers" = "0.5.6.2";
"filepath" = "1.4.2.1";
"process" = "1.6.5.0";
"pretty" = "1.1.3.6";
"ghc-boot-th" = "8.6.5";
"array" = "0.5.3.0";
"integer-gmp" = "1.0.2.0";
};
};
};
extras = hackage:
{ packages = { cabal-sublib = ./.plan.nix/cabal-sublib.nix; }; };
modules = [
({ lib, ... }:
{ packages = { "cabal-sublib" = { flags = {}; }; }; })
];
}

View File

@ -1,26 +1,31 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs }:
with stdenv.lib;
let
# This test could use cabalProject', but it does so that it
# tests using callCabalProjectToNix and importAndFilterProject
plan = (importAndFilterProject (callCabalProjectToNix {
name = "test-call-cabal-project-to-nix";
index-state = "2019-04-30T00:00:00Z";
# reuse the cabal-simple test project
src = ../cabal-simple;
}));
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = (importAndFilterProject (callCabalProjectToNix {
name = "test-call-cabal-project-to-nix";
index-state = "2019-04-30T00:00:00Z";
# reuse the cabal-simple test project
src = ../cabal-simple;
})).pkgs;
plan-pkgs = plan.pkgs;
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
plan-nix = plan.nix;
run = stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";
buildCommand = ''
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple"
exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.cabal-simple.components.exes.cabal-simple.run}
touch $out
'';
@ -31,4 +36,5 @@ in
# Attributes used for debugging with nix repl
inherit pkgSet packages;
};
}
};
}

View File

@ -1,25 +1,28 @@
{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject, recurseIntoAttrs }:
with stdenv.lib;
let
stack = importAndFilterProject (callStackToNix {
src = ../stack-simple;
});
pkgSet = mkStackPkgSet {
stack-pkgs = (importAndFilterProject (callStackToNix {
src = ../stack-simple;
})).pkgs;
stack-pkgs = stack.pkgs;
pkg-def-extras = [];
modules = [];
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
stack-nix = stack.nix;
run = stdenv.mkDerivation {
name = "callStackToNix-test";
buildCommand = ''
exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe"
exe="${packages.stack-simple.components.exes.stack-simple-exe}/bin/stack-simple-exe${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.stack-simple.components.exes.stack-simple-exe.run}
touch $out
'';
@ -30,4 +33,5 @@ in
# Attributes used for debugging with nix repl
inherit pkgSet packages;
};
}
};
}

View File

@ -6,7 +6,7 @@
with pkgs;
let
util = callPackage ./util.nix {};
util = import ./util.nix { inherit (pkgs.haskell-nix) cabal-install; };
in pkgs.recurseIntoAttrs {
inherit (haskell-nix) haskellNixRoots;
cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };

View File

@ -1,5 +1,5 @@
# Test a package set
{ stdenv, util, haskell-nix }:
{ stdenv, util, haskell-nix, recurseIntoAttrs }:
with stdenv.lib;
@ -11,8 +11,9 @@ let
packages = project.hsPkgs;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "exe-only-test";
buildCommand = ''
@ -53,4 +54,5 @@ in
# This just adds cabal-install to the existing shells.
test-shell = util.addCabalInstall packages.exe-only.components.all;
};
};
}

View File

@ -1,22 +1,19 @@
{ mkStackPkgSet, callStackToNix, importAndFilterProject
{ stackProject'
, stdenv, gmp6, openssl, zlib, libffi
, buildPackages
, recurseIntoAttrs
}:
with stdenv.lib;
let
# IFD stack-to-nix
stack-pkgs = (importAndFilterProject (callStackToNix {
src = ./.;
})).pkgs;
# Grab the compiler name from stack-to-nix output.
# compiler = (stack-pkgs.extras {}).compiler.nix-name;
compiler = "ghc865"; # fixme
pkgSet = { gpl ? true }: mkStackPkgSet {
inherit stack-pkgs;
# IFD stack-to-nix
project = { gpl ? true }: stackProject' {
src = ./.;
pkg-def-extras = [];
modules = [
# Musl libc fully static build
@ -52,10 +49,13 @@ let
})
];
};
packagesGmp = (pkgSet { gpl = true; }).config.hsPkgs;
packagesIntegerSimple = (pkgSet { gpl = false; }).config.hsPkgs;
in
stdenv.mkDerivation {
packagesGmp = (project { gpl = true; }).hsPkgs;
packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
in recurseIntoAttrs {
stack-nix-gmp = (project { gpl = true; }).stack-nix;
stack-nix-simple = (project { gpl = false; }).stack-nix;
run = stdenv.mkDerivation {
name = "fully-static-test";
depsBuildBuild = [ buildPackages.file ];
@ -63,10 +63,10 @@ in
buildCommand = flip concatMapStrings
[ packagesGmp /* packagesIntegerSimple */ ]
(packages: ''
exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc"
exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe --version
${toString packages.pandoc.components.exes.pandoc.config.testWrapper} $exe --version
'' + optionalString stdenv.hostPlatform.isMusl ''
printf "checking whether executable is static... " >& 2
@ -79,8 +79,11 @@ in
passthru = {
# Attributes used for debugging with nix repl
inherit pkgSet buildPackages stack-pkgs;
inherit buildPackages;
project-gmp = project { gpl = true; };
project-integer-simple = project { gpl = false; };
pandoc-gmp = packagesGmp.pandoc.components.exes.pandoc;
pandoc-integer-simple = packagesIntegerSimple.pandoc.components.exes.pandoc;
};
}
};
}

View File

@ -1,4 +1,4 @@
resolver: lts-13.26
resolver: lts-14.13
extra-deps:
- pandoc-2.7.3

View File

@ -1,28 +1,25 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, cabalProject', recurseIntoAttrs }:
with stdenv.lib;
let
plan = (importAndFilterProject (callCabalProjectToNix {
name = "test-ghc-options";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
}));
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = plan.pkgs;
project = cabalProject' {
name = "test-ghc-options";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
# TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix
modules = [ { packages.test-ghc-options.package.ghcOptions = "-DTEST_GHC_OPTION"; } ];
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";
buildCommand = ''
exe="${packages.test-ghc-options.components.exes.test-ghc-options-exe}/bin/test-ghc-options-exe"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
touch $out
'';
@ -31,7 +28,7 @@ in
passthru = {
# Attributes used for debugging with nix repl
inherit pkgSet packages;
plan-nix = plan.nix;
inherit project packages;
};
}
};
}

View File

@ -1,24 +1,21 @@
{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
{ stdenv, stackProject', recurseIntoAttrs }:
with stdenv.lib;
let
stack = (importAndFilterProject (callStackToNix {
project = stackProject' {
src = ./.;
}));
pkgSet = mkStackPkgSet {
stack-pkgs = stack.pkgs;
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) stack-nix;
run = stdenv.mkDerivation {
name = "callStackToNix-test";
buildCommand = ''
exe="${packages.test-ghc-options.components.exes.test-ghc-options-exe}/bin/test-ghc-options-exe"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.test-ghc-options.components.exes.test-ghc-options-exe.run}
touch $out
'';
@ -27,7 +24,7 @@ in
passthru = {
# Attributes used for debugging with nix repl
inherit pkgSet packages;
stack-nix = stack.nix;
inherit project packages;
};
}
};
}

View File

@ -1,4 +1,4 @@
resolver: lts-13.19
resolver: lts-14.13
packages:
- .

View File

@ -1,26 +1,25 @@
{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, cabalProject', recurseIntoAttrs }:
with stdenv.lib;
let
plan = (importAndFilterProject (callCabalProjectToNix {
name = "test-project-flags";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
}));
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = plan.pkgs;
project = cabalProject' {
name = "test-project-flags";
index-state = "2019-04-30T00:00:00Z";
src = ./.;
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) plan-nix;
run = stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";
buildCommand = ''
exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe"
exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
touch $out
'';
@ -32,4 +31,5 @@ in
inherit pkgSet packages;
plan-nix = plan.nix;
};
}
};
}

View File

@ -1,24 +1,23 @@
{ stdenv, mkStackPkgSet, callStackToNix, importAndFilterProject }:
{ stdenv, stackProject', recurseIntoAttrs }:
with stdenv.lib;
let
stack = (importAndFilterProject (callStackToNix {
project = stackProject' {
src = ./.;
}));
pkgSet = mkStackPkgSet {
stack-pkgs = stack.pkgs;
};
packages = pkgSet.config.hsPkgs;
in
stdenv.mkDerivation {
packages = project.hsPkgs;
in recurseIntoAttrs {
inherit (project) stack-nix;
run = stdenv.mkDerivation {
name = "callStackToNix-test";
buildCommand = ''
exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe"
exe="${packages.test-project-flags.components.exes.test-project-flags-exe}/bin/test-project-flags-exe${stdenv.hostPlatform.extensions.executable}"
printf "checking whether executable runs... " >& 2
$exe
cat ${packages.test-project-flags.components.exes.test-project-flags-exe.run}
touch $out
'';
@ -30,4 +29,5 @@ in
inherit pkgSet packages;
stack-nix = stack.nix;
};
}
};
}

View File

@ -1,4 +1,4 @@
resolver: lts-13.19
resolver: lts-14.13
packages:
- .

View File

@ -6,7 +6,7 @@ with stdenv.lib;
let
project = haskell-nix.cabalProject' {
name = "test-setup-deps";
src = ./.;
src = pkgs.haskell-nix.haskellLib.cleanGit { src = ../..; subDir = "test/setup-deps"; };
modules = [{
# Package has no exposed modules which causes
# haddock: No input file(s)
@ -16,10 +16,20 @@ let
};
packages = project.hsPkgs;
in recurseIntoAttrs {
plan = haskell-nix.withInputs project.plan-nix;
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
then
let skip = pkgs.runCommand "skip-test-setup-deps" {} ''
echo "Skipping setup-deps test on windows as it needs the ghc lib" >& 2
touch $out
'';
in {
plan-nix = skip;
run = skip;
}
else {
inherit (project) plan-nix;
run = pkgs.stdenv.mkDerivation {
name = "call-cabal-project-to-nix-test";
name = "setup-deps-test";
buildCommand = ''
exe="${packages.pkg.components.exes.pkg}/bin/pkg"
@ -30,11 +40,12 @@ in recurseIntoAttrs {
touch $out
'';
meta.platforms = platforms.all;
meta.platforms = platforms.unix;
meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
passthru = {
# Attributes used for debugging with nix repl
inherit project packages;
};
};
}
})

View File

@ -1,14 +1,11 @@
{ stdenv, cabal-install, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject }:
{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand }:
with stdenv.lib;
let
plan = importAndFilterProject (callCabalProjectToNix {
project = cabalProject' {
name = "test-shell-for-setup-deps";
src = ./.;
});
pkgSet = mkCabalProjectPkgSet {
plan-pkgs = plan.pkgs;
modules = [{
# Package has no exposed modules which causes
# haddock: No input file(s)
@ -16,10 +13,23 @@ let
}];
};
env = pkgSet.config.hsPkgs.shellFor {};
env = project.hsPkgs.shellFor {};
in
stdenv.mkDerivation {
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
then
let skip = runCommand "skipping-test-shell-for-setup-deps" {} ''
echo "Skipping shell-for-setup-deps test on windows as does not work yet" >& 2
touch $out
'';
in {
plan-nix = skip;
env = skip;
run = skip;
}
else {
inherit (project) plan-nix;
inherit env;
run = stdenv.mkDerivation {
name = "shell-for-test";
buildCommand = ''
@ -35,14 +45,14 @@ let
'';
meta.platforms = platforms.all;
meta.disabled = stdenv.hostPlatform.isMusl;
meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
passthru = {
# Used for debugging with nix repl
inherit pkgSet;
# Used for testing externally with nix-shell (../tests.sh).
inherit env;
plan-nix = plan.nix;
inherit project env;
};
}
};
})

View File

@ -1,4 +1,4 @@
{ stdenv, cabal-install, mkCabalProjectPkgSet }:
{ stdenv, cabal-install, mkCabalProjectPkgSet, recurseIntoAttrs, runCommand }:
with stdenv.lib;
@ -44,8 +44,21 @@ let
buildInputs = [ cabal-install ];
};
in
stdenv.mkDerivation {
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
then
let skip = runCommand "skip-test-shell-for" {} ''
echo "Skipping shell-for test on windows as does not work yet" >& 2
touch $out
'';
in {
env = skip;
envPkga = skip;
envDefault = skip;
run = skip;
}
else {
inherit env envPkga envDefault;
run = stdenv.mkDerivation {
name = "shell-for-test";
buildCommand = ''
@ -64,7 +77,7 @@ let
'';
meta.platforms = platforms.all;
meta.disabled = stdenv.hostPlatform.isMusl;
meta.disabled = stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWindows;
passthru = {
# Used for debugging with nix repl
@ -73,4 +86,5 @@ let
# Used for testing externally with nix-shell (../tests.sh).
inherit env envPkga envDefault;
};
}
};
})

View File

@ -1,16 +1,32 @@
{ stdenv, haskellPackages, snapshots }:
{ stdenv, haskellPackages, snapshots, recurseIntoAttrs, runCommand }:
with stdenv.lib;
let
env = snapshots."lts-12.21".ghcWithHoogle
env = snapshots."lts-14.13".ghcWithHoogle
(ps: with ps; [ conduit conduit-extra resourcet ]);
in
stdenv.mkDerivation {
in recurseIntoAttrs (if stdenv.hostPlatform.isWindows
then
let skip = runCommand "skip-test-snapshot" {} ''
echo "Skipping snapshot test on windows as does not work yet" >& 2
touch $out
'';
in {
env = skip;
run = skip;
}
else {
inherit env;
run = stdenv.mkDerivation {
name = "shell-for-test";
buildCommand = ''
buildCommand = if stdenv.hostPlatform.isWindows
then ''
printf "snapshot test is not working yet for windows. skipping. " >& 2
touch $out
''
else ''
########################################################################
# test single component from haskellPackages
@ -33,4 +49,5 @@ in
passthru = {
inherit env;
};
}
};
})

View File

@ -1,4 +1,4 @@
{ stdenv, util, mkPkgSet }:
{ stdenv, util, mkPkgSet, recurseIntoAttrs }:
with stdenv.lib;
with util;
@ -35,8 +35,15 @@ let
pkgId = p: "${p.identifier.name}-${p.identifier.version}";
showDepends = component: concatMapStringsSep " " pkgId component.depends;
in
stdenv.mkDerivation {
in recurseIntoAttrs {
# Used for testing externally with nix-shell (../tests.sh).
# This just adds cabal-install to the existing shells.
test-shell = addCabalInstall packages.test-with-packages.components.all;
# A variant of test-shell with the component option doExactConfig enabled
test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
run = stdenv.mkDerivation {
name = "with-packages-test";
libraryDepends = showDepends pkgSet.config.packages.test-with-packages.components.library;
allDepends = showDepends pkgSet.config.packages.test-with-packages.components.all;
@ -60,15 +67,19 @@ in
printf "checking that the 'library' component works... " >& 2
echo ${package.components.library} >& 2
'' + (if stdenv.hostPlatform.isWindows
then ''
printf "runghc tests are not working yet for windows. skipping. " >& 2
''
else ''
printf "checking that the package env has the dependencies... " >& 2
${package.components.all.env}/bin/runghc ${./Point.hs}
echo >& 2
printf "checking that the package env has the dependencies... " >& 2
${package.components.all.env}/bin/runghc ${./Point.hs}
echo >& 2
printf "checking that components.library.env has the dependencies... " >& 2
${library.env}/bin/runghc ${./Point.hs}
echo >& 2
printf "checking that components.library.env has the dependencies... " >& 2
${library.env}/bin/runghc ${./Point.hs}
echo >& 2
'') + ''
touch $out
'';
@ -78,12 +89,6 @@ in
passthru = {
# Used for debugging with nix repl
inherit packages pkgSet;
# Used for testing externally with nix-shell (../tests.sh).
# This just adds cabal-install to the existing shells.
test-shell = addCabalInstall packages.test-with-packages.components.all;
# A variant of test-shell with the component option doExactConfig enabled
test-shell-dec = addCabalInstall packages.test-with-packages.components.library;
};
};
}