Skip to content

Commit 34b18ba

Browse files
committed
Merge branch 'test-json' into derivation-work
2 parents 4f24c59 + f370397 commit 34b18ba

File tree

2 files changed

+59
-11
lines changed

2 files changed

+59
-11
lines changed

hnix-store-json/hnix-store-json.cabal

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,26 @@ extra-doc-files:
1717
extra-source-files:
1818
README.md
1919
data-files:
20-
upstream-libstore-data/build-result/*.json
21-
upstream-libstore-data/realisation/*.json
22-
upstream-libutil-data/nars/*.nar
20+
upstream-libstore-data/content-address/nar.json
21+
upstream-libstore-data/content-address/text.json
22+
upstream-libstore-data/derived-path/multi_built_built.json
23+
upstream-libstore-data/derived-path/multi_built_built_wildcard.json
24+
upstream-libstore-data/derived-path/multi_opaque.json
25+
upstream-libstore-data/derived-path/mutli_built.json
26+
upstream-libstore-data/derived-path/single_built_built.json
27+
upstream-libstore-data/derived-path/single_built.json
28+
upstream-libstore-data/derived-path/single_opaque.json
29+
upstream-libstore-data/outputs-spec/all.json
30+
upstream-libstore-data/outputs-spec/name.json
31+
upstream-libstore-data/outputs-spec/names.json
32+
upstream-libstore-data/realisation/simple.json
33+
upstream-libstore-data/realisation/with-dependent-realisations.json
34+
upstream-libstore-data/realisation/with-signature.json
35+
upstream-libstore-data/store-path/simple.json
36+
upstream-libutil-data/hash/sha256-base16.json
37+
upstream-libutil-data/hash/sha256-base64.json
38+
upstream-libutil-data/hash/sha256-nix32.json
39+
upstream-libutil-data/hash/simple.json
2340

2441
common commons
2542
ghc-options: -Wall
@@ -73,6 +90,8 @@ test-suite json
7390
SingleDerivedPathSpec
7491
StorePathSpec
7592
Paths_hnix_store_json
93+
autogen-modules:
94+
Paths_hnix_store_json
7695
hs-source-dirs:
7796
tests
7897
build-tool-depends:

overlay.nix

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,16 @@ in
1717
{
1818
hnix-store-core =
1919
lib.pipe
20-
(hself.callCabal2nix "hnix-store-core" ./hnix-store-core {})
20+
(hself.callCabal2nix "hnix-store-core" ./hnix-store-core/hnix-store-core.cabal {})
2121
[
22+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-core; }))
2223
haskellLib.compose.buildFromSdist
2324
];
2425
hnix-store-db =
2526
lib.pipe
26-
(hself.callCabal2nix "hnix-store-db" ./hnix-store-db {})
27+
(hself.callCabal2nix "hnix-store-db" ./hnix-store-db/hnix-store-db.cabal {})
2728
[
29+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-db; }))
2830
haskellLib.compose.buildFromSdist
2931
];
3032
hnix-store-aterm =
@@ -34,21 +36,46 @@ in
3436
haskellLib.compose.buildFromSdist
3537
];
3638
hnix-store-json =
39+
let
40+
# Include the JSON test data files from upstream Nix that we need
41+
# for testing.
42+
src = lib.fileset.toSource {
43+
root = ./.;
44+
fileset = lib.fileset.unions [
45+
./hnix-store-json
46+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/content-address)
47+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/derived-path)
48+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/outputs-spec)
49+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/realisation)
50+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/store-path)
51+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libutil-tests/data/hash)
52+
];
53+
};
54+
in
3755
lib.pipe
38-
(hself.callCabal2nix "hnix-store-json" ./hnix-store-json {})
56+
(hself.callCabal2nix "hnix-store-json" ./hnix-store-json/hnix-store-json.cabal {})
3957
[
58+
(drv: drv.overrideAttrs (old: {
59+
inherit src;
60+
# Set up symlinks to upstream data files
61+
postUnpack = ''
62+
sourceRoot+=/hnix-store-json
63+
'';
64+
}))
4065
haskellLib.compose.buildFromSdist
4166
];
4267
hnix-store-nar =
4368
lib.pipe
44-
(hself.callCabal2nix "hnix-store-nar" ./hnix-store-nar {})
69+
(hself.callCabal2nix "hnix-store-nar" ./hnix-store-nar/hnix-store-nar.cabal {})
4570
[
71+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-nar; }))
4672
haskellLib.compose.buildFromSdist
4773
];
4874
hnix-store-readonly =
4975
lib.pipe
50-
(hself.callCabal2nix "hnix-store-readonly" ./hnix-store-readonly {})
76+
(hself.callCabal2nix "hnix-store-readonly" ./hnix-store-readonly/hnix-store-readonly.cabal {})
5177
[
78+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-readonly; }))
5279
haskellLib.compose.buildFromSdist
5380
];
5481
hnix-store-remote =
@@ -60,10 +87,11 @@ in
6087
# after cabal2nix step
6188
(
6289
if pkgs.stdenv.isDarwin
63-
then hself.callCabal2nix "hnix-store-remote" ./hnix-store-remote {}
64-
else hself.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote "-fio-testsuite" {}
90+
then hself.callCabal2nix "hnix-store-remote" ./hnix-store-remote/hnix-store-remote.cabal {}
91+
else hself.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote/hnix-store-remote.cabal "-fio-testsuite" {}
6592
)
6693
[
94+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-remote; }))
6795
haskellLib.compose.buildFromSdist
6896
(pkg: pkg.overrideAttrs (attrs: {
6997
buildInputs = attrs.buildInputs ++ [
@@ -73,8 +101,9 @@ in
73101
];
74102
hnix-store-tests =
75103
lib.pipe
76-
(hself.callCabal2nix "hnix-store-tests" ./hnix-store-tests {})
104+
(hself.callCabal2nix "hnix-store-tests" ./hnix-store-tests/hnix-store-tests.cabal {})
77105
[
106+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-tests; }))
78107
haskellLib.compose.buildFromSdist
79108
];
80109
}

0 commit comments

Comments
 (0)