diff options
author | happysalada <raphael@megzari.com> | 2021-07-07 13:17:12 +0900 |
---|---|---|
committer | happysalada <raphael@megzari.com> | 2021-07-07 13:17:12 +0900 |
commit | 2021b5f0701322361165881c2173f2433c164e52 (patch) | |
tree | 9106b1b7ceda7b587c2a3da01616107dc1785af9 /pkgs/development/beam-modules | |
parent | 176b8cce2360c107b9310d3aa8d4c13a1b745d0a (diff) | |
download | nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar.gz nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar.bz2 nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar.lz nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar.xz nixpkgs-2021b5f0701322361165881c2173f2433c164e52.tar.zst nixpkgs-2021b5f0701322361165881c2173f2433c164e52.zip |
rebar3-release: nixpkgs-fmt
Diffstat (limited to 'pkgs/development/beam-modules')
-rw-r--r-- | pkgs/development/beam-modules/rebar3-release.nix | 146 |
1 files changed, 76 insertions, 70 deletions
diff --git a/pkgs/development/beam-modules/rebar3-release.nix b/pkgs/development/beam-modules/rebar3-release.nix index 16344f2f194..ba947ae7ec5 100644 --- a/pkgs/development/beam-modules/rebar3-release.nix +++ b/pkgs/development/beam-modules/rebar3-release.nix @@ -1,28 +1,34 @@ -{ stdenv, erlang, rebar3WithPlugins, openssl, - lib }: - -{ name, version +{ stdenv +, erlang +, rebar3WithPlugins +, openssl +, lib +}: + +{ name +, version , src -, beamDeps ? [] -, buildPlugins ? [] +, beamDeps ? [ ] +, buildPlugins ? [ ] , checkouts ? null , releaseType -, buildInputs ? [] +, buildInputs ? [ ] , setupHook ? null , profile ? "default" , installPhase ? null , buildPhase ? null , configurePhase ? null -, meta ? {} -, ... }@attrs: +, meta ? { } +, ... +}@attrs: with lib; let shell = drv: stdenv.mkDerivation { - name = "interactive-shell-${drv.name}"; - buildInputs = [ drv ]; - }; + name = "interactive-shell-${drv.name}"; + buildInputs = [ drv ]; + }; customPhases = filterAttrs (_: v: v != null) @@ -38,65 +44,65 @@ let }; pkg = - assert beamDeps != [] -> checkouts == null; + assert beamDeps != [ ] -> checkouts == null; self: stdenv.mkDerivation (attrs // { - name = "${name}-${version}"; - inherit version; - - buildInputs = buildInputs ++ [ erlang rebar3 openssl ] ++ beamDeps; - - # ensure we strip any native binaries (eg. NIFs, ports) - stripDebugList = lib.optional (releaseType == "release") "rel"; - - inherit src; - - REBAR_IGNORE_DEPS = beamDeps != [ ]; - - configurePhase = '' - runHook preConfigure - ${lib.optionalString (checkouts != null) - "cp --no-preserve=all -R ${checkouts}/_checkouts ."} - 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" "$out/bin" - cp -R --preserve=mode "_build/${profile}/$dir" "$out" - ${lib.optionalString (releaseType == "release") - "find $out/rel/*/bin -type f -executable -exec ln -s -t $out/bin {} \\;"} - runHook postInstall - ''; - - postInstall = '' - for dir in $out/rel/*/erts-*; do - echo "ERTS found in $dir - removing references to erlang to reduce closure size" - for f in $dir/bin/{erl,start}; do - substituteInPlace "$f" --replace "${erlang}/lib/erlang" "''${dir/\/erts-*/}" + name = "${name}-${version}"; + inherit version; + + buildInputs = buildInputs ++ [ erlang rebar3 openssl ] ++ beamDeps; + + # ensure we strip any native binaries (eg. NIFs, ports) + stripDebugList = lib.optional (releaseType == "release") "rel"; + + inherit src; + + REBAR_IGNORE_DEPS = beamDeps != [ ]; + + configurePhase = '' + runHook preConfigure + ${lib.optionalString (checkouts != null) + "cp --no-preserve=all -R ${checkouts}/_checkouts ."} + 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" "$out/bin" + cp -R --preserve=mode "_build/${profile}/$dir" "$out" + ${lib.optionalString (releaseType == "release") + "find $out/rel/*/bin -type f -executable -exec ln -s -t $out/bin {} \\;"} + runHook postInstall + ''; + + postInstall = '' + for dir in $out/rel/*/erts-*; do + echo "ERTS found in $dir - removing references to erlang to reduce closure size" + for f in $dir/bin/{erl,start}; do + substituteInPlace "$f" --replace "${erlang}/lib/erlang" "''${dir/\/erts-*/}" + done done - done - ''; - - meta = { - inherit (erlang.meta) platforms; - } // meta; - - passthru = ({ - packageName = name; - env = shell self; - } // (if attrs ? passthru then attrs.passthru else {})); - } // customPhases); + ''; + + meta = { + inherit (erlang.meta) platforms; + } // meta; + + passthru = ({ + packageName = name; + env = shell self; + } // (if attrs ? passthru then attrs.passthru else { })); + } // customPhases); in - fix pkg +fix pkg |