mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
Refactor fetchHex out of buildHex.
This will allow to reuse this code to fetch rebar3's dependencies to ensure it's hermetic build.
This commit is contained in:
parent
acaf2c179e
commit
033902d269
@ -1,4 +1,4 @@
|
||||
{ stdenv, erlang, rebar3, openssl, libyaml, fetchurl, fetchFromGitHub,
|
||||
{ stdenv, erlang, rebar3, openssl, libyaml, fetchHex, fetchFromGitHub,
|
||||
rebar3-pc }:
|
||||
|
||||
{ name, version, sha256
|
||||
@ -16,6 +16,12 @@ stdenv.mkDerivation (attrs // {
|
||||
|
||||
buildInputs = buildInputs ++ [ erlang rebar3 openssl libyaml ];
|
||||
|
||||
src = fetchHex {
|
||||
pkg = hexPkg;
|
||||
inherit version;
|
||||
inherit sha256;
|
||||
};
|
||||
|
||||
postPatch = let
|
||||
registrySnapshot = import ./registrySnapshot.nix { inherit fetchFromGitHub; };
|
||||
in ''
|
||||
@ -35,12 +41,6 @@ stdenv.mkDerivation (attrs // {
|
||||
${postPatch}
|
||||
'';
|
||||
|
||||
unpackCmd = ''
|
||||
tar -xf $curSrc contents.tar.gz
|
||||
mkdir contents
|
||||
tar -C contents -xzf contents.tar.gz
|
||||
'';
|
||||
|
||||
configurePhase = let
|
||||
plugins = pluginDeps ++ (if compilePorts then [rebar3-pc] else []);
|
||||
getDeps = drv: [drv] ++ (map getDeps drv.erlangDeps);
|
||||
@ -84,11 +84,6 @@ stdenv.mkDerivation (attrs // {
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://s3.amazonaws.com/s3.hex.pm/tarballs/${hexPkg}-${version}.tar";
|
||||
sha256 = sha256;
|
||||
};
|
||||
|
||||
meta = {
|
||||
inherit (erlang.meta) platforms;
|
||||
} // meta;
|
||||
|
34
pkgs/development/tools/build-managers/rebar3/fetch-hex.nix
Normal file
34
pkgs/development/tools/build-managers/rebar3/fetch-hex.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ stdenv, fetchurl }:
|
||||
|
||||
{ pkg, version, sha256
|
||||
, meta ? {}
|
||||
}:
|
||||
|
||||
with stdenv.lib;
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
name = "hex-source-${pkg}-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://s3.amazonaws.com/s3.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;
|
||||
})
|
@ -5020,6 +5020,7 @@ let
|
||||
|
||||
rebar = callPackage ../development/tools/build-managers/rebar { };
|
||||
rebar3 = callPackage ../development/tools/build-managers/rebar3 { };
|
||||
fetchHex = callPackage ../development/tools/build-managers/rebar3/fetch-hex.nix { };
|
||||
|
||||
erlangPackages = callPackage ../development/erlang-modules { };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user