nixpkgs-suyu/pkgs/development/beam-modules/fetch-hex.nix

39 lines
593 B
Nix
Raw Normal View History

2021-01-23 18:15:07 +01:00
{ lib, stdenv, fetchurl }:
2021-08-16 22:09:48 +02:00
{ pkg
, version
, sha256
, meta ? { }
}:
2021-01-23 18:15:07 +01:00
with lib;
stdenv.mkDerivation ({
2021-08-16 22:09:48 +02:00
pname = "hex-source-${pkg}";
inherit version;
2021-08-17 05:05:11 +02:00
dontBuild = true;
dontConfigure = true;
dontFixup = true;
src = fetchurl {
url = "https://repo.hex.pm/tarballs/${pkg}-${version}.tar";
inherit sha256;
};
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;
})