mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
beamPackages.mixRelease: support escript properly (#404412)
This commit is contained in:
commit
50c57d114c
3 changed files with 23 additions and 35 deletions
|
@ -25,20 +25,7 @@ mixRelease rec {
|
||||||
hash = "sha256-T1uL3xXXmCkobJJhS3p6xMrJUyiim3AMwaG87/Ix7A8=";
|
hash = "sha256-T1uL3xXXmCkobJJhS3p6xMrJUyiim3AMwaG87/Ix7A8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [ erlang ];
|
escriptBinName = "protoc-gen-elixir";
|
||||||
|
|
||||||
postBuild = ''
|
|
||||||
mix do escript.build
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp protoc-gen-elixir $out/bin
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.updateScript = nix-update-script { };
|
passthru.updateScript = nix-update-script { };
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ mixRelease {
|
||||||
elixir
|
elixir
|
||||||
;
|
;
|
||||||
|
|
||||||
|
escriptBinName = "ex_doc";
|
||||||
|
|
||||||
stripDebug = true;
|
stripDebug = true;
|
||||||
|
|
||||||
mixFodDeps = fetchMixDeps {
|
mixFodDeps = fetchMixDeps {
|
||||||
|
@ -38,25 +40,6 @@ mixRelease {
|
||||||
hash = "sha256-s4b6wuBJPdN0FPn76zbLCHzqJNEZ6E4nOyB1whUM2VY=";
|
hash = "sha256-s4b6wuBJPdN0FPn76zbLCHzqJNEZ6E4nOyB1whUM2VY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
configurePhase = ''
|
|
||||||
runHook preConfigure
|
|
||||||
mix deps.compile --no-deps-check
|
|
||||||
runHook postConfigure
|
|
||||||
'';
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
runHook preBuild
|
|
||||||
mix do escript.build
|
|
||||||
runHook postBuild
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp -v ex_doc $out/bin
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
tests = {
|
tests = {
|
||||||
# ex_doc is the doc generation for OTP 27+, so let's make sure they build
|
# ex_doc is the doc generation for OTP 27+, so let's make sure they build
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
# Build a particular named release.
|
# Build a particular named release.
|
||||||
# see https://hexdocs.pm/mix/1.12/Mix.Tasks.Release.html#content
|
# see https://hexdocs.pm/mix/1.12/Mix.Tasks.Release.html#content
|
||||||
mixReleaseName ? "",
|
mixReleaseName ? "",
|
||||||
|
# If set, the given escript binary will be copied to the output
|
||||||
|
# instead of the release
|
||||||
|
escriptBinName ? null,
|
||||||
|
|
||||||
# Options to be passed to the Erlang compiler. As documented in the reference
|
# Options to be passed to the Erlang compiler. As documented in the reference
|
||||||
# manual, these must be valid Erlang terms. They will be turned into an
|
# manual, these must be valid Erlang terms. They will be turned into an
|
||||||
|
@ -90,6 +93,7 @@ let
|
||||||
in
|
in
|
||||||
assert mixNixDeps != { } -> mixFodDeps == null;
|
assert mixNixDeps != { } -> mixFodDeps == null;
|
||||||
assert stripDebug -> !enableDebugInfo;
|
assert stripDebug -> !enableDebugInfo;
|
||||||
|
assert escriptBinName != null -> mixReleaseName == "";
|
||||||
|
|
||||||
stdenv.mkDerivation (
|
stdenv.mkDerivation (
|
||||||
overridable
|
overridable
|
||||||
|
@ -116,7 +120,7 @@ stdenv.mkDerivation (
|
||||||
makeWrapper
|
makeWrapper
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = buildInputs;
|
buildInputs = buildInputs ++ lib.optionals (escriptBinName != null) [ erlang ];
|
||||||
|
|
||||||
MIX_ENV = mixEnv;
|
MIX_ENV = mixEnv;
|
||||||
MIX_DEBUG = if enableDebugInfo then 1 else 0;
|
MIX_DEBUG = if enableDebugInfo then 1 else 0;
|
||||||
|
@ -199,6 +203,10 @@ stdenv.mkDerivation (
|
||||||
|
|
||||||
mix compile --no-deps-check ${lib.concatStringsSep " " compileFlags}
|
mix compile --no-deps-check ${lib.concatStringsSep " " compileFlags}
|
||||||
|
|
||||||
|
${lib.optionalString (escriptBinName != null) ''
|
||||||
|
mix escript.build --no-deps-check
|
||||||
|
''}
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -206,7 +214,17 @@ stdenv.mkDerivation (
|
||||||
attrs.installPhase or ''
|
attrs.installPhase or ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mix release ${mixReleaseName} --no-deps-check --path "$out"
|
${
|
||||||
|
if (escriptBinName != null) then
|
||||||
|
''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp ${escriptBinName} $out/bin
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
mix release ${mixReleaseName} --no-deps-check --path "$out"
|
||||||
|
''
|
||||||
|
}
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue