···2324 pkg = self: stdenv.mkDerivation (attrs // {
25 name = "${name}-${version}";
26- inherit version;
27- inherit src;
2829 MIX_ENV = mixEnv;
30 MIX_DEBUG = if enableDebugInfo then 1 else 0;
31 HEX_OFFLINE = 1;
3233- # stripping does not have any effect on beam files
34- dontStrip = true;
35-36 # add to ERL_LIBS so other modules can find at runtime.
37 # http://erlang.org/doc/man/code.html#code-path
38 # Mix also searches the code path when compiling with the --no-deps-check flag
···41 addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
42 '';
4344- buildInputs = buildInputs ++ [ elixir hex ];
45 propagatedBuildInputs = propagatedBuildInputs ++ beamDeps;
4647 buildPhase = attrs.buildPhase or ''
···7273 runHook postInstall
74 '';
00007576 passthru = {
77 packageName = name;
···2324 pkg = self: stdenv.mkDerivation (attrs // {
25 name = "${name}-${version}";
26+ inherit version src buildInputs;
02728 MIX_ENV = mixEnv;
29 MIX_DEBUG = if enableDebugInfo then 1 else 0;
30 HEX_OFFLINE = 1;
3100032 # add to ERL_LIBS so other modules can find at runtime.
33 # http://erlang.org/doc/man/code.html#code-path
34 # Mix also searches the code path when compiling with the --no-deps-check flag
···37 addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
38 '';
3940+ nativeBuildInputs = [ elixir hex ];
41 propagatedBuildInputs = propagatedBuildInputs ++ beamDeps;
4243 buildPhase = attrs.buildPhase or ''
···6869 runHook postInstall
70 '';
71+72+ # stripping does not have any effect on beam files
73+ # it is however needed for dependencies with NIFs like bcrypt for example
74+ dontStrip = false;
7576 passthru = {
77 packageName = name;
···42 buildInputs = buildInputs ++ [ erlang rebar3 openssl libyaml ];
43 propagatedBuildInputs = unique beamDeps;
44045 inherit src;
46+47+ # stripping does not have any effect on beam files
48+ # it is however needed for dependencies with NIFs
49+ # false is the default but we keep this for readability
50+ dontStrip = false;
5152 setupHook = writeText "setupHook.sh" ''
53 addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
+20-19
pkgs/development/beam-modules/mix-release.nix
···1-{ stdenv, lib, elixir, erlang, findutils, hex, rebar, rebar3, fetchMixDeps, makeWrapper, git }:
23{ pname
4, version
···23in
24assert mixNixDeps != { } -> mixFodDeps == null;
25stdenv.mkDerivation (overridable // {
26- nativeBuildInputs = nativeBuildInputs ++ [ erlang hex elixir makeWrapper git ];
027 buildInputs = builtins.attrValues mixNixDeps;
2829 MIX_ENV = mixEnv;
···31 HEX_OFFLINE = 1;
32 DEBUG = if enableDebugInfo then 1 else 0; # for Rebar3 compilation
33 # the api with `mix local.rebar rebar path` makes a copy of the binary
34- MIX_REBAR = "${rebar}/bin/rebar";
35 MIX_REBAR3 = "${rebar3}/bin/rebar3";
3637 postUnpack = ''
···82 runHook postInstall
83 '';
8485- fixupPhase = ''
86- runHook preFixup
0087 if [ -e "$out/bin/${pname}.bat" ]; then # absent in special cases, i.e. elixir-ls
88 rm "$out/bin/${pname}.bat" # windows file
89 fi
···94 if [ -e $out/releases/COOKIE ]; then # absent in special cases, i.e. elixir-ls
95 rm $out/releases/COOKIE
96 fi
97- # TODO remove the uneeded reference too erlang
98- # one possible way would be
99- # for f in $(${findutils}/bin/find $out -name start); do
100- # substituteInPlace $f \
101- # --replace 'ROOTDIR=${erlang}/lib/erlang' 'ROOTDIR=""'
102- # done
103- # What is left to do is to check that erlang is not required on
104- # the host
105-106- patchShebangs $out
107- runHook postFixup
108 '';
109- # TODO figure out how to do a Fixed Output Derivation and add the output hash
110- # This doesn't play well at the moment with Phoenix projects
111- # for example that have frontend dependencies
112000113 # disallowedReferences = [ erlang ];
114})
···1+{ stdenv, lib, elixir, erlang, findutils, hex, rebar3, fetchMixDeps, makeWrapper, git, ripgrep }:
23{ pname
4, version
···23in
24assert mixNixDeps != { } -> mixFodDeps == null;
25stdenv.mkDerivation (overridable // {
26+ # rg is used as a better grep to search for erlang references in the final release
27+ nativeBuildInputs = nativeBuildInputs ++ [ erlang hex elixir makeWrapper git ripgrep ];
28 buildInputs = builtins.attrValues mixNixDeps;
2930 MIX_ENV = mixEnv;
···32 HEX_OFFLINE = 1;
33 DEBUG = if enableDebugInfo then 1 else 0; # for Rebar3 compilation
34 # the api with `mix local.rebar rebar path` makes a copy of the binary
035 MIX_REBAR3 = "${rebar3}/bin/rebar3";
3637 postUnpack = ''
···82 runHook postInstall
83 '';
8485+ # Stripping of the binary is intentional
86+ # even though it does not affect beam files
87+ # it is necessary for NIFs binaries
88+ postFixup = ''
89 if [ -e "$out/bin/${pname}.bat" ]; then # absent in special cases, i.e. elixir-ls
90 rm "$out/bin/${pname}.bat" # windows file
91 fi
···96 if [ -e $out/releases/COOKIE ]; then # absent in special cases, i.e. elixir-ls
97 rm $out/releases/COOKIE
98 fi
99+ # removing unused erlang reference from resulting derivation to reduce
100+ # closure size
101+ if [ -e $out/erts-* ]; then
102+ echo "ERTS found in $out - removing references to erlang to reduce closure size"
103+ # there is a link in $out/erts-*/bin/start always
104+ # sometimes there are links in dependencies like bcrypt compiled binaries
105+ for file in $(rg "${erlang}/lib/erlang" "$out" --text --files-with-matches); do
106+ substituteInPlace "$file" --replace "${erlang}/lib/erlang" "$out"
107+ done
108+ fi
0109 '';
000110111+ # TODO investigate why the resulting closure still has
112+ # a reference to erlang.
113+ # uncommenting the following will fail the build
114 # disallowedReferences = [ erlang ];
115})
···39 description = "Allows you to expose a web server running on your local machine to the internet";
40 homepage = "https://ngrok.com/";
41 license = licenses.unfree;
42- platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
43 maintainers = [ maintainers.bobvanderlinden ];
44 };
45}
···39 description = "Allows you to expose a web server running on your local machine to the internet";
40 homepage = "https://ngrok.com/";
41 license = licenses.unfree;
42+ platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
43 maintainers = [ maintainers.bobvanderlinden ];
44 };
45}
+1
pkgs/tools/networking/ngrok-2/update.sh
···29 get_download_info linux arm
30 get_download_info linux arm64
31 get_download_info darwin amd64
032) | jq --slurp 'map ({ (.sys): . }) | add' \
33 > pkgs/tools/networking/ngrok-2/versions.json
···29 get_download_info linux arm
30 get_download_info linux arm64
31 get_download_info darwin amd64
32+ get_download_info darwin arm64
33) | jq --slurp 'map ({ (.sys): . }) | add' \
34 > pkgs/tools/networking/ngrok-2/versions.json