polynom-flake/pkgs/eturnal/default.nix

47 lines
1.0 KiB
Nix

{
stdenv, lib
, fetchFromGitHub, fetchHex
, beam, autoPatchelfHook
, erlang, libyaml, openssl, gnutar, rebar3
}:
let
deps = import ./deps.nix {
inherit fetchFromGitHub fetchHex;
};
in stdenv.mkDerivation rec {
name = "eturnal";
version = "1.8.3";
buildInputs = [
rebar3 openssl gnutar libyaml erlang
];
postPatch = ''
sed --in-place -e "s|/opt/eturnal|$out|g" build.config
# Otherwise the script won't find tr and sed
sed --in-place -e "s|export PATH='/usr/local/bin:/usr/bin:/bin'||g" scripts/get-version
cat build.config
'';
buildPhase = ''
mkdir -p _checkouts
${toString (lib.mapAttrsToList (k: v: ''
cp -R --no-preserve=mode ${v} _checkouts/${k}
'') deps)}
HOME=. rebar3 as prod tar
'';
installPhase = ''
mkdir -p $out
tar -xzf _build/prod/rel/*/*.tar.gz -C $out/
'';
src = fetchFromGitHub {
owner = "processone";
repo = "eturnal";
rev = version;
sha256 = "sha256-mIQOVS1nB+DEpwDRX7xoCFqkEHpWYcKnP1KVUxfrVCA=";
};
}