Skip to content

Instantly share code, notes, and snippets.

Last active November 1, 2016 01:51
What would you like to do?
# use it like this: (import ./fetch-cabal pkgs pkgs.haskellPackages).fetchZip "url" "sha256" "subfolder in archive"
pkgs: haskellPackages:
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