mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55: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=";
|
||||
};
|
||||
|
||||
buildInputs = [ erlang ];
|
||||
|
||||
postBuild = ''
|
||||
mix do escript.build
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp protoc-gen-elixir $out/bin
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
escriptBinName = "protoc-gen-elixir";
|
||||
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ mixRelease {
|
|||
elixir
|
||||
;
|
||||
|
||||
escriptBinName = "ex_doc";
|
||||
|
||||
stripDebug = true;
|
||||
|
||||
mixFodDeps = fetchMixDeps {
|
||||
|
@ -38,25 +40,6 @@ mixRelease {
|
|||
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 = {
|
||||
tests = {
|
||||
# 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.
|
||||
# see https://hexdocs.pm/mix/1.12/Mix.Tasks.Release.html#content
|
||||
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
|
||||
# manual, these must be valid Erlang terms. They will be turned into an
|
||||
|
@ -90,6 +93,7 @@ let
|
|||
in
|
||||
assert mixNixDeps != { } -> mixFodDeps == null;
|
||||
assert stripDebug -> !enableDebugInfo;
|
||||
assert escriptBinName != null -> mixReleaseName == "";
|
||||
|
||||
stdenv.mkDerivation (
|
||||
overridable
|
||||
|
@ -116,7 +120,7 @@ stdenv.mkDerivation (
|
|||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = buildInputs;
|
||||
buildInputs = buildInputs ++ lib.optionals (escriptBinName != null) [ erlang ];
|
||||
|
||||
MIX_ENV = mixEnv;
|
||||
MIX_DEBUG = if enableDebugInfo then 1 else 0;
|
||||
|
@ -199,6 +203,10 @@ stdenv.mkDerivation (
|
|||
|
||||
mix compile --no-deps-check ${lib.concatStringsSep " " compileFlags}
|
||||
|
||||
${lib.optionalString (escriptBinName != null) ''
|
||||
mix escript.build --no-deps-check
|
||||
''}
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
|
@ -206,7 +214,17 @@ stdenv.mkDerivation (
|
|||
attrs.installPhase or ''
|
||||
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
|
||||
'';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue