about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test/haskell/cabalSdist/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/test/haskell/cabalSdist/default.nix')
-rw-r--r--nixpkgs/pkgs/test/haskell/cabalSdist/default.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/test/haskell/cabalSdist/default.nix b/nixpkgs/pkgs/test/haskell/cabalSdist/default.nix
new file mode 100644
index 000000000000..1031e51e4f14
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/cabalSdist/default.nix
@@ -0,0 +1,28 @@
+{ lib, haskellPackages, runCommand }:
+
+let
+  localRaw = haskellPackages.callPackage ./local/generated.nix {};
+in
+lib.recurseIntoAttrs rec {
+
+  helloFromCabalSdist = haskellPackages.buildFromCabalSdist haskellPackages.hello;
+
+  # A more complicated example with a cabal hook.
+  hercules-ci-cnix-store = haskellPackages.buildFromCabalSdist haskellPackages.hercules-ci-cnix-store;
+
+  localFromCabalSdist = haskellPackages.buildFromCabalSdist localRaw;
+
+  assumptionLocalHasDirectReference = runCommand "localHasDirectReference" {
+    drvPath = builtins.unsafeDiscardOutputDependency localRaw.drvPath;
+  } ''
+    grep ${./local} $drvPath >/dev/null
+    touch $out
+  '';
+
+  localHasNoDirectReference = runCommand "localHasNoDirectReference" {
+    drvPath = builtins.unsafeDiscardOutputDependency localFromCabalSdist.drvPath;
+  } ''
+    grep -v ${./local} $drvPath >/dev/null
+    touch $out
+  '';
+}