Created
May 26, 2017 18:00
-
-
Save Profpatsch/bfe0d13de28413e68c783a9aa0fe8962 to your computer and use it in GitHub Desktop.
hpack to nix file in nix expression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
hpack2nix = | |
name: src: | |
let | |
addCabalFile = stdenv.mkDerivation { | |
inherit name src; | |
phases = [ "unpackPhase" "patchPhase" "installPhase" ]; | |
installPhase = ''cp -r . $out''; | |
patchPhase = '' | |
${haskellPackages.hpack}/bin/hpack | |
''; | |
}; | |
nixFile = runCommand "${name}.nix" {} '' | |
cd ${addCabalFile} | |
find | |
${haskellPackages.cabal2nix}/bin/cabal2nix . > $out | |
sed -ie "s|\./\.|${addCabalFile}|" $out | |
''; | |
in nixFile; | |
in hpack2nix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
needs
with import <nixpkgs> {};
at the top to bring in therunCommand
function