diff options
author | Robert Hensing <robert@roberthensing.nl> | 2022-05-23 21:39:01 +0200 |
---|---|---|
committer | Robert Hensing <robert@roberthensing.nl> | 2022-05-23 22:28:57 +0200 |
commit | cf5e2d510316ae0e2e78486e28b79b1fa30799fa (patch) | |
tree | f0e7099c9c90d89d4d65399239eb448749213fdf /pkgs/test/haskell/cabalSdist | |
parent | d06c3e06e580b4f7868812e91644768ee2398e5b (diff) |
haskellPackages: Add buildFromCabalSdist (faster, tested)
Diffstat (limited to 'pkgs/test/haskell/cabalSdist')
-rw-r--r-- | pkgs/test/haskell/cabalSdist/default.nix | 28 | ||||
-rw-r--r-- | pkgs/test/haskell/cabalSdist/local/CHANGELOG.md | 5 | ||||
-rw-r--r-- | pkgs/test/haskell/cabalSdist/local/app/Main.hs | 4 | ||||
-rw-r--r-- | pkgs/test/haskell/cabalSdist/local/local.cabal | 13 |
4 files changed, 50 insertions, 0 deletions
diff --git a/pkgs/test/haskell/cabalSdist/default.nix b/pkgs/test/haskell/cabalSdist/default.nix new file mode 100644 index 0000000000000..2ab815f5d4f62 --- /dev/null +++ b/pkgs/test/haskell/cabalSdist/default.nix @@ -0,0 +1,28 @@ +{ lib, haskellPackages, runCommand }: + +let + localRaw = haskellPackages.callCabal2nix "local" ./local {}; +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 + ''; +} diff --git a/pkgs/test/haskell/cabalSdist/local/CHANGELOG.md b/pkgs/test/haskell/cabalSdist/local/CHANGELOG.md new file mode 100644 index 0000000000000..53cc3ae43d8a2 --- /dev/null +++ b/pkgs/test/haskell/cabalSdist/local/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for local + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/pkgs/test/haskell/cabalSdist/local/app/Main.hs b/pkgs/test/haskell/cabalSdist/local/app/Main.hs new file mode 100644 index 0000000000000..65ae4a05d5db9 --- /dev/null +++ b/pkgs/test/haskell/cabalSdist/local/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = putStrLn "Hello, Haskell!" diff --git a/pkgs/test/haskell/cabalSdist/local/local.cabal b/pkgs/test/haskell/cabalSdist/local/local.cabal new file mode 100644 index 0000000000000..1670aa3af631f --- /dev/null +++ b/pkgs/test/haskell/cabalSdist/local/local.cabal @@ -0,0 +1,13 @@ +cabal-version: 2.4 +name: local +version: 0.1.0.0 + +synopsis: Nixpkgs test case +license: MIT +extra-source-files: CHANGELOG.md + +executable local + main-is: Main.hs + build-depends: base + hs-source-dirs: app + default-language: Haskell2010 |