3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/beam-modules/fetch-hex.nix

35 lines
563 B
Nix
Raw Normal View History

2021-01-23 17:15:07 +00:00
{ lib, stdenv, fetchurl }:
{ pkg, version, sha256
, meta ? {}
}:
2021-01-23 17:15:07 +00:00
with lib;
stdenv.mkDerivation ({
name = "hex-source-${pkg}-${version}";
src = fetchurl {
url = "https://repo.hex.pm/tarballs/${pkg}-${version}.tar";
inherit sha256;
};
phases = [ "unpackPhase" "installPhase" ];
unpackCmd = ''
tar -xf $curSrc contents.tar.gz
mkdir contents
tar -C contents -xzf contents.tar.gz
'';
installPhase = ''
runHook preInstall
mkdir "$out"
cp -Hrt "$out" .
success=1
runHook postInstall
'';
inherit meta;
})