nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 71 lines 2.3 kB view raw
1{ 2 lib, 3 writeText, 4 srcOnly, 5 haskellPackages, 6 cabal-install, 7}: 8 9(haskellPackages.shellFor { 10 packages = p: [ 11 p.constraints 12 p.cereal 13 ]; 14 # WARNING: When updating this, make sure that the libraries passed to 15 # `extraDependencies` are not actually transitive dependencies of libraries in 16 # `packages` above. We explicitly want to test that it is possible to specify 17 # `extraDependencies` that are not in the closure of `packages`. 18 extraDependencies = p: { libraryHaskellDepends = [ p.conduit ]; }; 19 nativeBuildInputs = [ cabal-install ]; 20 unpackPhase = '' 21 sourceRoot=$(pwd)/scratch 22 mkdir -p "$sourceRoot" 23 cd "$sourceRoot" 24 cp -r "${srcOnly haskellPackages.constraints}" constraints 25 cp -r "${srcOnly haskellPackages.cereal}" cereal 26 cp ${writeText "cabal.project" "packages: constraints cereal"} cabal.project 27 ''; 28 buildPhase = '' 29 export HOME=$(mktemp -d) 30 mkdir -p $HOME/.cabal 31 touch $HOME/.cabal/config 32 33 # Check that the extraDependencies.libraryHaskellDepends arg is correctly 34 # picked up. This uses ghci to interpret a small Haskell program that uses 35 # a package from extraDependencies. 36 ghci <<EOF 37 :set -XOverloadedStrings 38 :m + Conduit 39 runResourceT $ connect (yield "done") (sinkFile "outfile") 40 EOF 41 42 if [[ "done" != "$(cat outfile)" ]]; then 43 echo "ERROR: extraDependencies appear not to be available in the environment" 44 exit 1 45 fi 46 47 # Check packages arg 48 cabal v2-build --offline --verbose constraints cereal --ghc-options="-O0 -j$NIX_BUILD_CORES" 49 ''; 50 installPhase = '' 51 touch $out 52 ''; 53}).overrideAttrs 54 (oldAttrs: { 55 meta = 56 let 57 oldMeta = oldAttrs.meta or { }; 58 oldMaintainers = oldMeta.maintainers or [ ]; 59 additionalMaintainers = with lib.maintainers; [ cdepillabout ]; 60 allMaintainers = oldMaintainers ++ additionalMaintainers; 61 in 62 oldMeta 63 // { 64 maintainers = allMaintainers; 65 inherit (cabal-install.meta) platforms; 66 }; 67 # `shellFor` adds a `buildCommand` (via `envFunc -> runCommandCC`), which 68 # overrides custom phases. To ensure this test's phases run, we remove 69 # that `buildCommand` from the derivation. 70 buildCommand = null; 71 })