1{
2 lib,
3 buildPackages,
4 stdenv,
5 mkMesonExecutable,
6
7 nix-fetchers,
8 nix-fetchers-c,
9 nix-store-test-support,
10
11 libgit2,
12 rapidcheck,
13 gtest,
14 runCommand,
15
16 # Configuration Options
17
18 version,
19 resolvePath,
20}:
21
22mkMesonExecutable (finalAttrs: {
23 pname = "nix-fetchers-tests";
24 inherit version;
25
26 workDir = ./.;
27
28 buildInputs = [
29 nix-fetchers
30 nix-store-test-support
31 rapidcheck
32 gtest
33 ]
34 ++ lib.optionals (lib.versionAtLeast version "2.29pre") [
35 nix-fetchers-c
36 ]
37 ++ lib.optionals (lib.versionAtLeast version "2.27") [
38 libgit2
39 ];
40
41 mesonFlags = [
42 ];
43
44 passthru = {
45 tests = {
46 run =
47 runCommand "${finalAttrs.pname}-run"
48 {
49 meta.broken = !stdenv.hostPlatform.emulatorAvailable buildPackages;
50 }
51 (
52 lib.optionalString stdenv.hostPlatform.isWindows ''
53 export HOME="$PWD/home-dir"
54 mkdir -p "$HOME"
55 ''
56 + ''
57 export _NIX_TEST_UNIT_DATA=${resolvePath ./data}
58 ${stdenv.hostPlatform.emulator buildPackages} ${lib.getExe finalAttrs.finalPackage}
59 touch $out
60 ''
61 );
62 };
63 };
64
65 meta = {
66 platforms = lib.platforms.unix ++ lib.platforms.windows;
67 mainProgram = finalAttrs.pname + stdenv.hostPlatform.extensions.executable;
68 };
69
70})