1{
2 lib,
3 haskell,
4 haskellPackages,
5 runCommand,
6}:
7
8let
9 localRaw = haskellPackages.callPackage ./generated.nix { };
10in
11lib.recurseIntoAttrs rec {
12
13 helloFromCabalSdist = haskellPackages.buildFromCabalSdist haskellPackages.hello;
14
15 # A more complicated example with a cabal hook.
16 hercules-ci-cnix-store = haskellPackages.buildFromCabalSdist haskellPackages.hercules-ci-cnix-store;
17
18 localFromCabalSdist = haskellPackages.buildFromCabalSdist localRaw;
19
20 # This test makes sure that localHasNoDirectReference can actually fail if
21 # it doesn't do anything. If this test fails, either the test setup was broken,
22 # or Haskell packaging has changed the way `src` is treated in such a way that
23 # either the test or the design of `buildFromCabalSdist` needs to be reconsidered.
24 assumptionLocalHasDirectReference =
25 runCommand "localHasDirectReference"
26 {
27 drvPath = builtins.unsafeDiscardOutputDependency localRaw.drvPath;
28 }
29 ''
30 grep ${localRaw.src} $drvPath >/dev/null
31 touch $out
32 '';
33
34 localHasNoDirectReference =
35 runCommand "localHasNoDirectReference"
36 {
37 drvPath = builtins.unsafeDiscardOutputDependency localFromCabalSdist.drvPath;
38 }
39 ''
40 grep -v ${localRaw.src} $drvPath >/dev/null
41 touch $out
42 '';
43}