on iko/ghcjs-patch-master help sign in
Fix evaluation on Hydra (#153)
8512832Rodney Lorrimar
@@ -43,18 +43,20 @@ let
43 cleanSourceHaskell = pkgs.callPackage ./lib/clean-source-haskell.nix {};
43 cleanSourceHaskell = pkgs.callPackage ./lib/clean-source-haskell.nix {};
44
44
45 # All packages from Hackage as Nix expressions
45 # All packages from Hackage as Nix expressions
46− hackage = import (fetchExternal {
46+ hackageSrc = fetchExternal {
47 name = "hackage-exprs-source";
47 name = "hackage-exprs-source";
48 specJSON = hackageSourceJSON;
48 specJSON = hackageSourceJSON;
49 override = "hackage";
49 override = "hackage";
50− });
50+ };
51+ hackage = import hackageSrc;
51
52
52 # The set of all Stackage snapshots
53 # The set of all Stackage snapshots
53− stackage = import (fetchExternal {
54+ stackageSrc = fetchExternal {
54 name = "stackage-snapshot-source";
55 name = "stackage-snapshot-source";
55 specJSON = stackageSourceJSON;
56 specJSON = stackageSourceJSON;
56 override = "stackage";
57 override = "stackage";
57− });
58+ };
59+ stackage = import stackageSrc;
58
60
59 packages = self: ({
61 packages = self: ({
60 # Utility functions for working with the component builder.
62 # Utility functions for working with the component builder.
@@ -196,6 +198,11 @@ let
196 inherit (pkgs.haskellPackages) hpack;
198 inherit (pkgs.haskellPackages) hpack;
197 inherit (self) nix-tools;
199 inherit (self) nix-tools;
198 };
200 };
201+
202+ # References to the unpacked sources, for caching in a Hydra jobset.
203+ source-pins = self.callPackage ./lib/make-source-pins.nix {
204+ sources = [ hackageSrc stackageSrc pkgs.path ];
205+ };
199 });
206 });
200
207
201in
208in
lib/make-source-pins.nixnew file+11
@@ -0,0 +1,11 @@
1+# Writes the store paths of a list of sources into a file.
2+# If this derivation is built by Hydra, then the sources will
3+# be kept and will be available to download from the binary cache.
4+{ lib, writeTextFile
5+, sources # A list of paths
6+}:
7+
8+writeTextFile {
9+ name = "haskell.nix-source-pins";
10+ text = lib.concatMapStringsSep "\n" toString sources;
11+}
nixpkgs/default.nix+5−1
@@ -2,5 +2,9 @@ let
2 fetch = jsonFile:
2 fetch = jsonFile:
3 with builtins;
3 with builtins;
4 let spec = fromJSON (readFile jsonFile);
4 let spec = fromJSON (readFile jsonFile);
5+ in fetchTarball {
6+ name = "nixpkgs";
7+ inherit (spec) sha256;
5− in fetchTarball { inherit (spec) sha256; url = "${spec.url}/archive/${spec.rev}.tar.gz"; };
8+ url = "${spec.url}/archive/${spec.rev}.tar.gz";
9+ };
6in import (fetch ./github.json)
10in import (fetch ./github.json)
nixpkgs/github.json+3−3
@@ -1,7 +1,7 @@
1{
1{
2− "url": "https://github.com/nixos/nixpkgs",
2+ "url": "https://github.com/NixOS/nixpkgs",
3− "rev": "db85ded4aae63508934dc42064c7fbff16e0ec21",
3+ "rev": "0728c3e026e3ac2542a9673d57533829e552e218",
4 "date": "2019-05-17T15:35:26+02:00",
4 "date": "2019-05-17T15:35:26+02:00",
5− "sha256": "0b91n0s5zaamxh9842ns11s40678sv4pbpxaxdqnrnkrkp8pn9gy",
5+ "sha256": "0sp8giack8na9hdm8ivk969mpwfcavqrfy7kncx0a1hs1ykw15hy",
6 "fetchSubmodules": false
6 "fetchSubmodules": false
7}
7}
release.nix+2−1
@@ -1,6 +1,7 @@
1let
1let
2 haskell = import ./default.nix {};
2 haskell = import ./default.nix {};
3in {
3in {
4− inherit (haskell) nix-tools;
4+ inherit (haskell) nix-tools source-pins;
5+
5 tests = import ./test { inherit haskell; };
6 tests = import ./test { inherit haskell; };
6}
7}
test/default.nix+8−4
@@ -18,12 +18,16 @@ in {
18 stack-simple = haskell.callPackage ./stack-simple {};
18 stack-simple = haskell.callPackage ./stack-simple {};
19 snapshots = haskell.callPackage ./snapshots {};
19 snapshots = haskell.callPackage ./snapshots {};
20 shell-for = haskell.callPackage ./shell-for {};
20 shell-for = haskell.callPackage ./shell-for {};
21− callStackToNix = haskell.callPackage ./callStackToNix {};
21+ # callStackToNix = haskell.callPackage ./callStackToNix {};
22− callCabalProjectToNix = haskell.callPackage ./call-cabal-project-to-nix {};
22+ # callCabalProjectToNix = haskell.callPackage ./call-cabal-project-to-nix {};
23
23
24− # Run unit tests with: nix-instantiate --eval --strict -A unit
24+ # Run unit tests with: nix-instantiate --eval --strict -A unit.tests
25 # An empty list means success.
25 # An empty list means success.
26+ unit = let
26− unit = haskell.callPackage ./unit.nix {};
27+ tests = haskell.callPackage ./unit.nix {};
28+ in runCommand "unit-tests" { passthru = { inherit tests; }; }
29+ (lib.concatMapStringsSep "\n" (t: "echo ${t.name} failed") tests +
30+ (if builtins.length tests == 0 then "\ntouch $out" else "\nexit 1"));
27}
31}
28
32
29## more possible test cases
33## more possible test cases
test/tests.sh+1−1
@@ -16,7 +16,7 @@ nix build $NIX_BUILD_ARGS --no-link --keep-going -f ./default.nix
16echo >& 2
16echo >& 2
17
17
18printf "*** Running the unit tests... " >& 2
18printf "*** Running the unit tests... " >& 2
19−res=$(nix-instantiate --eval --json --strict ./default.nix -A unit)
19+res=$(nix-instantiate --eval --json --strict ./default.nix -A unit.tests)
20num_failed=$(jq length <<< "$res")
20num_failed=$(jq length <<< "$res")
21if [ $num_failed -eq 0 ]; then
21if [ $num_failed -eq 0 ]; then
22 printf "PASSED\n" >& 2
22 printf "PASSED\n" >& 2