Skip to content

Commit 8308c3c

Browse files
committed
Fix nix build, and also avoid IFD rebuilds
There is no good reason to call `cabal2nix` on the entire source dir, it should only be called on the cabal file itself.
1 parent e88d11a commit 8308c3c

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

overlay.nix

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,59 @@ in
2929

3030
hnix-store-core =
3131
lib.pipe
32-
(hself.callCabal2nix "hnix-store-core" ./hnix-store-core {})
32+
(hself.callCabal2nix "hnix-store-core" ./hnix-store-core/hnix-store-core.cabal {})
3333
[
34+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-core; }))
3435
haskellLib.compose.buildFromSdist
3536
];
3637
hnix-store-db =
3738
lib.pipe
38-
(hself.callCabal2nix "hnix-store-db" ./hnix-store-db {})
39+
(hself.callCabal2nix "hnix-store-db" ./hnix-store-db/hnix-store-db.cabal {})
3940
[
41+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-db; }))
4042
haskellLib.compose.buildFromSdist
4143
];
4244
hnix-store-json =
45+
let
46+
# Include the JSON test data files from upstream Nix that we need
47+
# for testing.
48+
src = lib.fileset.toSource {
49+
root = ./.;
50+
fileset = lib.fileset.unions [
51+
./hnix-store-json
52+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/content-address)
53+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/derived-path)
54+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/outputs-spec)
55+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/realisation)
56+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libstore-tests/data/store-path)
57+
(lib.fileset.fileFilter (file: file.hasExt "json") ./upstream-nix/src/libutil-tests/data/hash)
58+
];
59+
};
60+
in
4361
lib.pipe
44-
(hself.callCabal2nix "hnix-store-json" ./hnix-store-json {})
62+
(hself.callCabal2nix "hnix-store-json" ./hnix-store-json/hnix-store-json.cabal {})
4563
[
64+
(drv: drv.overrideAttrs (old: {
65+
inherit src;
66+
# Set up symlinks to upstream data files
67+
postUnpack = ''
68+
sourceRoot+=/hnix-store-json
69+
'';
70+
}))
4671
haskellLib.compose.buildFromSdist
4772
];
4873
hnix-store-nar =
4974
lib.pipe
50-
(hself.callCabal2nix "hnix-store-nar" ./hnix-store-nar {})
75+
(hself.callCabal2nix "hnix-store-nar" ./hnix-store-nar/hnix-store-nar.cabal {})
5176
[
77+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-nar; }))
5278
haskellLib.compose.buildFromSdist
5379
];
5480
hnix-store-readonly =
5581
lib.pipe
56-
(hself.callCabal2nix "hnix-store-readonly" ./hnix-store-readonly {})
82+
(hself.callCabal2nix "hnix-store-readonly" ./hnix-store-readonly/hnix-store-readonly.cabal {})
5783
[
84+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-readonly; }))
5885
haskellLib.compose.buildFromSdist
5986
];
6087
hnix-store-remote =
@@ -66,10 +93,11 @@ in
6693
# after cabal2nix step
6794
(
6895
if pkgs.stdenv.isDarwin
69-
then hself.callCabal2nix "hnix-store-remote" ./hnix-store-remote {}
70-
else hself.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote "-fio-testsuite" {}
96+
then hself.callCabal2nix "hnix-store-remote" ./hnix-store-remote/hnix-store-remote.cabal {}
97+
else hself.callCabal2nixWithOptions "hnix-store-remote" ./hnix-store-remote/hnix-store-remote.cabal "-fio-testsuite" {}
7198
)
7299
[
100+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-remote; }))
73101
haskellLib.compose.buildFromSdist
74102
(pkg: pkg.overrideAttrs (attrs: {
75103
buildInputs = attrs.buildInputs ++ [
@@ -79,8 +107,9 @@ in
79107
];
80108
hnix-store-tests =
81109
lib.pipe
82-
(hself.callCabal2nix "hnix-store-tests" ./hnix-store-tests {})
110+
(hself.callCabal2nix "hnix-store-tests" ./hnix-store-tests/hnix-store-tests.cabal {})
83111
[
112+
(drv: drv.overrideAttrs (old: { src = ./hnix-store-tests; }))
84113
haskellLib.compose.buildFromSdist
85114
];
86115
}

0 commit comments

Comments
 (0)