Last active
November 1, 2016 01:51
-
-
Save 3noch/ffd80e935dec7a2a91d1f92207cb2a76 to your computer and use it in GitHub Desktop.
This file contains 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
# use it like this: (import ./fetch-cabal pkgs pkgs.haskellPackages).fetchZip "url" "sha256" "subfolder in archive" | |
pkgs: haskellPackages: | |
let | |
srcPackage = src: folder: | |
pkgs.runCommand "src-package" | |
{ | |
inherit src; | |
buildInputs = [ pkgs.cabal2nix ]; | |
} | |
'' | |
mkdir -p $out | |
cp -r $src/${folder}/* $out | |
cd $out | |
cabal2nix . > package.nix | |
''; | |
fetch = src: folder: haskellPackages.callPackage "${srcPackage src folder}/package.nix" {}; | |
in { | |
inherit fetch; | |
fromGit = url: rev: sha256: fetch (pkgs.fetchgit { | |
inherit url rev sha256; | |
}); | |
fromZip = url: sha256: fetch (pkgs.fetchzip { | |
inherit url sha256; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment