about summary refs log tree commit diff
path: root/pkgs/development/beam-modules/rebar3-release.nix
diff options
context:
space:
mode:
authork32 <10274441+k32@users.noreply.github.com>2019-01-16 22:51:19 +0100
committerk32 <10274441+k32@users.noreply.github.com>2019-02-06 19:45:40 +0100
commitd4b243905f2181111b52d5a58b2119469ed689fc (patch)
tree895379986d9b69a9cfcbb503c92bf040908da34a /pkgs/development/beam-modules/rebar3-release.nix
parented5ec8b375e6a2b254c6110ff5124b3a95e019d7 (diff)
downloadnixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar.gz
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar.bz2
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar.lz
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar.xz
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.tar.zst
nixlib-d4b243905f2181111b52d5a58b2119469ed689fc.zip
rebar3: 3.6.1 -> 3.9.0
Remove hermetic patch (make it compatible with the upstream)
(Mostly) eliminate the need for hex package registry
Diffstat (limited to 'pkgs/development/beam-modules/rebar3-release.nix')
-rw-r--r--pkgs/development/beam-modules/rebar3-release.nix85
1 files changed, 85 insertions, 0 deletions
diff --git a/pkgs/development/beam-modules/rebar3-release.nix b/pkgs/development/beam-modules/rebar3-release.nix
new file mode 100644
index 000000000000..837d0ccf15cf
--- /dev/null
+++ b/pkgs/development/beam-modules/rebar3-release.nix
@@ -0,0 +1,85 @@
+{ stdenv, writeText, erlang, rebar3, openssl, libyaml,
+  pc, lib }:
+
+{ name, version
+, src
+, checkouts ? null
+, releaseType
+, buildInputs ? []
+, setupHook ? null
+, profile ? "default"
+, installPhase ? null
+, buildPhase ? null
+, configurePhase ? null
+, meta ? {}
+, enableDebugInfo ? false
+, ... }@attrs:
+
+with stdenv.lib;
+
+let
+  debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "debug-info";
+
+  shell = drv: stdenv.mkDerivation {
+          name = "interactive-shell-${drv.name}";
+          buildInputs = [ drv ];
+    };
+
+  customPhases = filterAttrs
+    (_: v: v != null)
+    { inherit setupHook configurePhase buildPhase installPhase; };
+
+  pkg = self: stdenv.mkDerivation (attrs // {
+
+    name = "${name}-${version}";
+    inherit version;
+
+    buildInputs = buildInputs ++ [ erlang rebar3 openssl ];
+    propagatedBuildInputs = [checkouts];
+
+    dontStrip = true;
+
+    inherit src;
+
+    setupHook = writeText "setupHook.sh" ''
+       addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
+    '';
+
+    configurePhase = ''
+      runHook preConfigure
+      ${if checkouts != null then
+          ''cp --no-preserve=all -R ${checkouts}/_checkouts .''
+        else
+          ''''}
+      runHook postConfigure
+    '';
+
+    buildPhase = ''
+      runHook preBuild
+      HOME=. DEBUG=1 rebar3 as ${profile} ${if releaseType == "escript"
+                                            then '' escriptize''
+                                            else '' release''}
+      runHook postBuild
+    '';
+
+    installPhase = ''
+      runHook preInstall
+      dir=${if releaseType == "escript"
+            then ''bin''
+            else ''rel''}
+      mkdir -p "$out/$dir"
+      cp -R --preserve=mode "_build/${profile}/$dir" "$out"
+      runHook postInstall
+    '';
+
+    meta = {
+      inherit (erlang.meta) platforms;
+    } // meta;
+
+    passthru = {
+      packageName = name;
+      env = shell self;
+   };
+  } // customPhases);
+in
+  fix pkg