cabal: add support for "editedCabalFile" attribute to address https://github.com/NixOS/cabal2nix/issues/84

When 'editedCabalFile' is set to an SHA256 hash, the build driver replaces the
original Cabal instructions with the new version that is downloaded from
"http://hackage.haskell.org/package/${fname}/${pname}.cabal".
This commit is contained in:
Peter Simons 2014-11-25 13:22:45 +01:00
parent 1bd68c4478
commit c7d3f60217

View File

@ -189,7 +189,16 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
configurePhase = ''
eval "$preConfigure"
${optionalString self.jailbreak "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
${let newCabalFile = fetchurl {
url = "http://hackage.haskell.org/package/${self.fname}/${self.pname}.cabal";
sha256 = self.editedCabalFile;
};
in
optionalString (self.editedCabalFile or "" != "") ''
echo "Replace Cabal file with edited version ${newCabalFile}."
cp ${newCabalFile} ${self.pname}.cabal
''
}${optionalString self.jailbreak "${jailbreakCabal}/bin/jailbreak-cabal ${self.pname}.cabal"}
for i in Setup.hs Setup.lhs ${defaultSetupHs}; do
test -f $i && break