about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test/haskell/shellFor/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/test/haskell/shellFor/default.nix')
-rw-r--r--nixpkgs/pkgs/test/haskell/shellFor/default.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/test/haskell/shellFor/default.nix b/nixpkgs/pkgs/test/haskell/shellFor/default.nix
new file mode 100644
index 000000000000..37ad2e90d89e
--- /dev/null
+++ b/nixpkgs/pkgs/test/haskell/shellFor/default.nix
@@ -0,0 +1,33 @@
+{ lib, writeText, haskellPackages, cabal-install }:
+
+(haskellPackages.shellFor {
+  packages = p: [ p.constraints p.linear ];
+  nativeBuildInputs = [ cabal-install ];
+  phases = [ "unpackPhase" "buildPhase" "installPhase" ];
+  unpackPhase = ''
+    sourceRoot=$(pwd)/scratch
+    mkdir -p "$sourceRoot"
+    cd "$sourceRoot"
+    tar -xf ${haskellPackages.constraints.src}
+    tar -xf ${haskellPackages.linear.src}
+    cp ${writeText "cabal.project" "packages: constraints* linear*"} cabal.project
+  '';
+  buildPhase = ''
+    export HOME=$(mktemp -d)
+    mkdir -p $HOME/.cabal
+    touch $HOME/.cabal/config
+    cabal v2-build --offline --verbose constraints linear --ghc-options="-O0 -j$NIX_BUILD_CORES"
+  '';
+  installPhase = ''
+    touch $out
+  '';
+}).overrideAttrs (oldAttrs: {
+  meta =
+    let
+      oldMeta = oldAttrs.meta or {};
+      oldMaintainers = oldMeta.maintainers or [];
+      additionalMaintainers = with lib.maintainers; [ cdepillabout ];
+      allMaintainers = oldMaintainers ++ additionalMaintainers;
+    in
+    oldMeta // { maintainers = allMaintainers; };
+})