Skip to content

Commit a70d879

Browse files
committed
Add backpack test
1 parent 4035dc4 commit a70d879

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

test/backpack/cabal.project

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
allow-newer:
2+
, unpacked-containers:*
3+
, unpacked-unordered-containers:*
4+
5+
source-repository-package
6+
type: git
7+
location: https://github.com/ekmett/unpacked-containers
8+
tag: 7dc56993a57511b58257b5d389473e638a7082d2
9+
--sha256: 1vijp2hs9ynfm8k2yrv06ccpfi1n2s2b5bqvzrjdd3gqn4bi66q4
10+
subdir:
11+
unpacked-containers
12+
unpacked-unordered-containers
13+

test/backpack/default.nix

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{ stdenv
2+
, lib
3+
, fetchFromGitHub
4+
, cabalProject'
5+
, haskellLib
6+
, recurseIntoAttrs
7+
, compiler-nix-name
8+
, evalPackages
9+
, ...
10+
}:
11+
12+
13+
let
14+
project = cabalProject' {
15+
inherit compiler-nix-name evalPackages;
16+
src = fetchFromGitHub {
17+
owner = "ekmett";
18+
repo = "unpacked-containers";
19+
rev = "7dc56993a57511b58257b5d389473e638a7082d2";
20+
hash = "sha256-BBsTF7H4jdZk/huvsoQWNkR3GTNgZy8mqs76pKG4Mu4=";
21+
};
22+
cabalProjectLocal = ''
23+
allow-newer:
24+
, unpacked-containers:*
25+
, unpacked-unordered-containers:*
26+
'';
27+
28+
};
29+
30+
packages = haskellLib.selectProjectPackages project.hsPkgs;
31+
components = lib.concatMap haskellLib.getAllComponents (lib.attrValues packages);
32+
33+
in
34+
recurseIntoAttrs {
35+
ifdInputs = {
36+
plan-nix = lib.addMetaAttrs
37+
{
38+
platforms = lib.platforms.all;
39+
# Making this work for cross compilers will be difficult.
40+
disabled = stdenv.buildPlatform != stdenv.hostPlatform;
41+
}
42+
project.plan-nix;
43+
};
44+
45+
run = stdenv.mkDerivation {
46+
name = "backpack-test";
47+
48+
buildCommand = ''
49+
printf ${lib.concatStringsSep " " components}
50+
touch $out
51+
'';
52+
53+
meta = {
54+
platforms = lib.platforms.all;
55+
};
56+
57+
passthru = {
58+
# Used for debugging with nix repl
59+
inherit project packages;
60+
};
61+
};
62+
}

test/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ let
178178

179179
# All tests.
180180
allTests = {
181+
backpack = callTest ./backpack { };
181182
cabal-simple = callTest ./cabal-simple { inherit util; };
182183
cabal-simple-debug = callTest ./cabal-simple-debug { inherit util; };
183184
cabal-simple-prof = callTest ./cabal-simple-prof { inherit util; };

0 commit comments

Comments
 (0)