on iko/ghcjs-patch-master help sign in
Test setup deps issue depending on ghc and Cabal (#278)
a5f9f45Hamish Mackenzie
@@ -20,17 +20,20 @@ let
20 darcs = (self.haskell-nix.hackage-package {
20 darcs = (self.haskell-nix.hackage-package {
21 name = "darcs";
21 name = "darcs";
22 version = "2.14.2";
22 version = "2.14.2";
23+ index-state = "2019-10-28T00:00:00Z";
23 # Apply the latest darcs.net Setup.hs patches
24 # Apply the latest darcs.net Setup.hs patches
24 modules = [{packages.darcs.patches = [ ./patches/darcs-setup.patch ];}];
25 modules = [{packages.darcs.patches = [ ./patches/darcs-setup.patch ];}];
25 }).components.exes.darcs;
26 }).components.exes.darcs;
26 })]; } // nixpkgsArgs);
27 })]; } // nixpkgsArgs);
27 haskell = pkgs.haskell-nix;
28 haskell = pkgs.haskell-nix;
28
29
29−in {
30+in rec {
30− inherit (haskell) haskellNixRoots;
31 tests = import ./test/default.nix { inherit nixpkgs nixpkgsArgs; };
31 tests = import ./test/default.nix { inherit nixpkgs nixpkgsArgs; };
32
32
33 # Scripts for keeping Hackage and Stackage up to date, and CI tasks.
33 # Scripts for keeping Hackage and Stackage up to date, and CI tasks.
34+ # The dontRecurseIntoAttrs prevents these from building on hydra
35+ # as not all of them can work in restricted eval mode (as they
36+ # are not pure).
34 maintainer-scripts = pkgs.dontRecurseIntoAttrs {
37 maintainer-scripts = pkgs.dontRecurseIntoAttrs {
35 update-hackage = haskell.callPackage ./scripts/update-hackage.nix {};
38 update-hackage = haskell.callPackage ./scripts/update-hackage.nix {};
36 update-stackage = haskell.callPackage ./scripts/update-stackage.nix {};
39 update-stackage = haskell.callPackage ./scripts/update-stackage.nix {};
@@ -51,4 +54,14 @@ in {
51 check-hydra = haskell.callPackage ./scripts/check-hydra.nix {};
54 check-hydra = haskell.callPackage ./scripts/check-hydra.nix {};
52 check-closure-size = haskell.callPackage ./scripts/check-closure-size.nix {};
55 check-closure-size = haskell.callPackage ./scripts/check-closure-size.nix {};
53 };
56 };
57+
58+ # These are pure parts of maintainer-script so they can be built by hydra
59+ # and added to the cache to speed up buildkite.
60+ maintainer-script-cache = pkgs.recurseIntoAttrs {
61+ inherit (maintainer-scripts) update-docs check-hydra check-closure-size;
62+ # Some of the dependencies of the impure scripts so that they will
63+ # will be in the cache too for buildkite.
64+ inherit (pkgs) coreutils glibc git openssh cabal-install nix-prefetch-git;
65+ inherit (haskell) nix-tools;
66+ };
54}
67}
builder/comp-builder.nix+1
@@ -146,6 +146,7 @@ stdenv.mkDerivation ({
146 license-map = import ../lib/cabal-licenses.nix lib;
146 license-map = import ../lib/cabal-licenses.nix lib;
147 in license-map.${package.license} or
147 in license-map.${package.license} or
148 (builtins.trace "WARNING: license \"${package.license}\" not found" license-map.LicenseRef-OtherLicense);
148 (builtins.trace "WARNING: license \"${package.license}\" not found" license-map.LicenseRef-OtherLicense);
149+ platforms = if component.platforms == null then stdenv.lib.platforms.all else component.platforms;
149 };
150 };
150
151
151 LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
152 LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
builder/setup-builder.nix+11
@@ -41,6 +41,17 @@ in
41 inherit configFiles cleanSrc;
41 inherit configFiles cleanSrc;
42 };
42 };
43
43
44+ meta = {
45+ homepage = package.homepage;
46+ description = package.synopsis;
47+ license =
48+ let
49+ license-map = import ../lib/cabal-licenses.nix lib;
50+ in license-map.${package.license} or
51+ (builtins.trace "WARNING: license \"${package.license}\" not found" license-map.LicenseRef-OtherLicense);
52+ platforms = if component.platforms == null then stdenv.lib.platforms.all else component.platforms;
53+ };
54+
44 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
55 phases = ["unpackPhase" "patchPhase" "buildPhase" "installPhase"];
45 buildPhase = ''
56 buildPhase = ''
46 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
57 if [[ ! -f ./Setup.hs && ! -f ./Setup.lhs ]]; then
compiler/bootstrap/cabal-install.nix+4
@@ -41,6 +41,10 @@ in stdenv.mkDerivation ({
41 inherit version;
41 inherit version;
42 };
42 };
43
43
44+ meta = {
45+ platforms = stdenv.lib.platforms.all;
46+ };
47+
44 nativeBuildInputs = [ ghc zlib ];
48 nativeBuildInputs = [ ghc zlib ];
45
49
46 inherit src;
50 inherit src;
modules/package.nix+5
@@ -210,6 +210,10 @@ in {
210 type = listOfFilteringNulls unspecified;
210 type = listOfFilteringNulls unspecified;
211 default = [];
211 default = [];
212 };
212 };
213+ platforms = mkOption {
214+ type = nullOr (listOfFilteringNulls unspecified);
215+ default = null;
216+ };
213 };
217 };
214 };
218 };
215 in {
219 in {
@@ -232,6 +236,7 @@ in {
232 cxxSources = [];
236 cxxSources = [];
233 jsSources = [];
237 jsSources = [];
234 extraSrcFiles = [ "Setup.hs" "Setup.lhs" ];
238 extraSrcFiles = [ "Setup.hs" "Setup.lhs" ];
239+ platforms = null;
235 };
240 };
236 };
241 };
237 library = mkOption {
242 library = mkOption {
nixpkgs/github.json+4−4
@@ -1,7 +1,7 @@
1{
1{
2− "url": "https://github.com/NixOS/nixpkgs",
2+ "url": "https://github.com/input-output-hk/nixpkgs",
3− "rev": "5000b1478a11acbff7d95519c7300f3e6691885d",
3+ "rev": "3d623a406cec9052ae0a16a79ce3ce9de11236bb",
4− "date": "2019-10-13T18:41:59-04:00",
4+ "date": "2019-10-18T17:51:24+13:00",
5− "sha256": "0yyhkf48b15dcnq0gbiyi4ypjn09a0mpy6v7yilidwqydmkc0wxr",
5+ "sha256": "1a4yd980ylh1ygvmws15wldifz7jxjy8z07vc914kam1p25yjpj1",
6 "fetchSubmodules": false
6 "fetchSubmodules": false
7}
7}
overlays/ghc-packages.nix+1
@@ -84,6 +84,7 @@ in rec {
84 ghc-extra-projects = builtins.mapAttrs (name: proj: self.haskell-nix.cabalProject' {
84 ghc-extra-projects = builtins.mapAttrs (name: proj: self.haskell-nix.cabalProject' {
85 name = "ghc-extra-packages";
85 name = "ghc-extra-packages";
86 src = proj;
86 src = proj;
87+ index-state = "2019-10-31T00:00:00Z";
87 ghc = self.buildPackages.haskell.compiler.${name};
88 ghc = self.buildPackages.haskell.compiler.${name};
88 })
89 })
89 ghc-extra-pkgs-cabal-projects;
90 ghc-extra-pkgs-cabal-projects;
release.nix+3−2
@@ -1,4 +1,4 @@
1−{ supportedSystems ? [ "x86_64-linux" ] # spare our "x86_64-darwin" builders for now
1+{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
2, scrubJobs ? true
2, scrubJobs ? true
3, haskell-nix ? { outPath = ./.; rev = "abcdef"; }
3, haskell-nix ? { outPath = ./.; rev = "abcdef"; }
4, nixpkgsArgs ? {}
4, nixpkgsArgs ? {}
@@ -24,7 +24,8 @@ let
24
24
25 jobs = {
25 jobs = {
26 native = filterTests (mapTestOn (packagePlatforms pkgs));
26 native = filterTests (mapTestOn (packagePlatforms pkgs));
27+ # Disabled for now. Something is wrong and this would require `allowBroken`
27− "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
28+ # "${musl64.config}" = filterTests (mapTestOnCross musl64 (packagePlatforms pkgs));
28 } // {
29 } // {
29 # On IOHK Hydra, "required" is a special job that updates the
30 # On IOHK Hydra, "required" is a special job that updates the
30 # GitHub CI status.
31 # GitHub CI status.
scripts/check-hydra.nix+1
@@ -13,6 +13,7 @@ writeScript "check-hydra.sh" ''
13 command time --format '%e' -o eval-time.txt \
13 command time --format '%e' -o eval-time.txt \
14 hydra-eval-jobs \
14 hydra-eval-jobs \
15 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
15 --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
16+ --arg supportedSystems '[ builtins.currentSystem ]' \
16 -I . release.nix > eval.json
17 -I . release.nix > eval.json
17 EVAL_EXIT_CODE="$?"
18 EVAL_EXIT_CODE="$?"
18 if [ "$EVAL_EXIT_CODE" != 0 ]
19 if [ "$EVAL_EXIT_CODE" != 0 ]
test/default.nix+3−1
@@ -1,5 +1,5 @@
1{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
1{ pkgs ? import nixpkgs ((import ../.) // nixpkgsArgs)
2−, nixpkgs ? <nixpkgs>
2+, nixpkgs ? ../nixpkgs
3, nixpkgsArgs ? { }
3, nixpkgsArgs ? { }
4}:
4}:
5
5
@@ -8,6 +8,7 @@ with pkgs;
8let
8let
9 util = callPackage ./util.nix {};
9 util = callPackage ./util.nix {};
10in pkgs.recurseIntoAttrs {
10in pkgs.recurseIntoAttrs {
11+ inherit (haskell-nix) haskellNixRoots;
11 cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };
12 cabal-simple = haskell-nix.callPackage ./cabal-simple { inherit util; };
12 cabal-simple-prof = haskell-nix.callPackage ./cabal-simple-prof { inherit util; };
13 cabal-simple-prof = haskell-nix.callPackage ./cabal-simple-prof { inherit util; };
13 cabal-sublib = haskell-nix.callPackage ./cabal-sublib { inherit util; };
14 cabal-sublib = haskell-nix.callPackage ./cabal-sublib { inherit util; };
@@ -18,6 +19,7 @@ in pkgs.recurseIntoAttrs {
18 snapshots = haskell-nix.callPackage ./snapshots {};
19 snapshots = haskell-nix.callPackage ./snapshots {};
19 shell-for = haskell-nix.callPackage ./shell-for {};
20 shell-for = haskell-nix.callPackage ./shell-for {};
20 shell-for-setup-deps = haskell-nix.callPackage ./shell-for-setup-deps {};
21 shell-for-setup-deps = haskell-nix.callPackage ./shell-for-setup-deps {};
22+ setup-deps = import ./setup-deps { inherit pkgs; };
21 callStackToNix = haskell-nix.callPackage ./call-stack-to-nix {};
23 callStackToNix = haskell-nix.callPackage ./call-stack-to-nix {};
22 callCabalProjectToNix = haskell-nix.callPackage ./call-cabal-project-to-nix {};
24 callCabalProjectToNix = haskell-nix.callPackage ./call-cabal-project-to-nix {};
23 cabal-source-repo = haskell-nix.callPackage ./cabal-source-repo {};
25 cabal-source-repo = haskell-nix.callPackage ./cabal-source-repo {};
test/setup-deps/cabal.projectnew file+3
@@ -0,0 +1,3 @@
1+index-state: 2019-10-01T00:00:00Z
2+
3+packages: pkg
test/setup-deps/default.nixnew file+39
@@ -0,0 +1,39 @@
1+{ pkgs }:
2+
3+with pkgs;
4+with stdenv.lib;
5+
6+let
7+ project = haskell-nix.cabalProject' {
8+ src = ./.;
9+ modules = [{
10+ # Package has no exposed modules which causes
11+ # haddock: No input file(s)
12+ packages.bytestring-builder.doHaddock = false;
13+ }
14+ { reinstallableLibGhc = true; } ];
15+ };
16+
17+ packages = project.hsPkgs;
18+in recurseIntoAttrs {
19+ plan = haskell-nix.withInputs project.plan-nix;
20+ run = pkgs.stdenv.mkDerivation {
21+ name = "call-cabal-project-to-nix-test";
22+
23+ buildCommand = ''
24+ exe="${packages.pkg.components.exes.pkg}/bin/pkg"
25+
26+ printf "checking whether executable runs... " >& 2
27+ $exe
28+
29+ touch $out
30+ '';
31+
32+ meta.platforms = platforms.all;
33+
34+ passthru = {
35+ # Attributes used for debugging with nix repl
36+ inherit project packages;
37+ };
38+ };
39+}
test/setup-deps/pkg/Setup.hsnew file+27
@@ -0,0 +1,27 @@
1+import Distribution.Simple
2+
3+-- https://github.com/snoyberg/conduit#readme
4+
5+import Conduit
6+import System.Directory (removeFile)
7+
8+-- Make sure Cabal and ghc were included
9+import Distribution.Package ()
10+import Ar ()
11+
12+example = do
13+ -- Pure operations: summing numbers.
14+ print $ runConduitPure $ yieldMany [1..10] .| sumC
15+
16+ -- Exception safe file access: copy a file.
17+ writeFile "input.txt" "This is a test." -- create the source file
18+ runConduitRes $ sourceFileBS "input.txt" .| sinkFile "output.txt" -- actual copying
19+ readFile "output.txt" >>= putStrLn -- prove that it worked
20+
21+ -- Perform transformations.
22+ print $ runConduitPure $ yieldMany [1..10] .| mapC (+ 1) .| sinkList
23+
24+ removeFile "input.txt"
25+ removeFile "output.txt"
26+
27+main = defaultMain
test/setup-deps/pkg/app/Main.hsnew file+6
@@ -0,0 +1,6 @@
1+module Main where
2+
3+import qualified Data.Text.IO as T
4+
5+main :: IO ()
6+main = return ()
test/setup-deps/pkg/pkg.cabalnew file+36
@@ -0,0 +1,36 @@
1+cabal-version: 2.2
2+-- Initial package description 'pkgb.cabal' generated by 'cabal init'. For
3+-- further documentation, see http://haskell.org/cabal/users-guide/
4+
5+name: pkg
6+version: 0.1.0.0
7+-- synopsis:
8+-- description:
9+-- bug-reports:
10+license: LicenseRef-PublicDomain
11+author: Rodney Lorrimar
12+maintainer: rodney.lorrimar@iohk.io
13+category: Testing
14+
15+custom-setup
16+ setup-depends: conduit
17+ , conduit-extra
18+ , Cabal
19+ , ghc
20+
21+library
22+ exposed-modules: Pkg
23+ build-depends: base
24+ hs-source-dirs: src
25+ default-language: Haskell2010
26+ build-tools: alex, happy
27+
28+executable pkg
29+ main-is: Main.hs
30+ -- other-modules:
31+ -- other-extensions:
32+ build-depends: base
33+ , optparse-applicative
34+ , text
35+ hs-source-dirs: app
36+ default-language: Haskell2010
test/setup-deps/pkg/src/conduit-test.hsnew file+5
@@ -0,0 +1,5 @@
1+module Main where
2+
3+import Conduit
4+
5+main = return ()