extendDrvArgs
pkgs.beamPackages.mixRelease.extendDrvArgs
Docs pulled from | This Revision | 20 minutes ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
Noogle detected
Implementation
The following is the current implementation of this function.
finalAttrs:
{
pname,
version,
src,
nativeBuildInputs ? [ ],
buildInputs ? [ ],
meta ? { },
enableDebugInfo ? false,
mixEnv ? "prod",
mixTarget ? "host",
compileFlags ? [ ],
mixCompileFlags ? compileFlags,
# 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
# erlang list and set as the ERL_COMPILER_OPTIONS environment variable.
# See https://www.erlang.org/doc/man/compile
erlangCompilerOptions ? [ ],
# Deterministic Erlang builds remove full system paths from debug information
# among other things to keep builds more reproducible. See their docs for more:
# https://www.erlang.org/doc/man/compile
erlangDeterministicBuilds ? true,
# Mix dependencies provided as a fixed output derivation
mixFodDeps ? null,
# Mix dependencies generated by mix2nix
#
# This assumes each dependency is built by buildMix or buildRebar3. Each
# dependency needs to have a setup hook to add the lib path to $ERL_LIBS.
# This is how Mix finds dependencies.
mixNixDeps ? { },
# Remove releases/COOKIE
#
# People have different views on the nature of cookies. Some believe that they are
# secrets, while others believe they are just ids for clustering nodes instead of
# secrets.
#
# If you think cookie is secret, you can set this attr to true, then it will be
# removed from nix store. If not, you can set it to false.
#
# For backward compatibility, it is set to true by default.
#
# You can always specify a custom cookie by using RELEASE_COOKIE environment
# variable, regardless of the value of this attr.
removeCookie ? true,
# This reduces closure size, but can lead to some hard to understand runtime
# errors, so use with caution. See e.g.
# https://github.com/whitfin/cachex/issues/205
# https://framagit.org/framasoft/mobilizon/-/issues/1169
stripDebug ? false,
...
}@attrs:
assert lib.assertMsg (!(attrs ? elixir || attrs ? erlang || attrs ? hex))
"mixRelease no longer takes `elixir`, `erlang` or `hex`. Build with the package set that has the versions you need, e.g. `beam27Packages.mixRelease`, or derive one with `beamPackages.overrideScope (final: prev: { elixir = prev.elixir_1_18; })`.";
assert mixNixDeps != { } -> mixFodDeps == null;
assert stripDebug -> !enableDebugInfo;
assert escriptBinName != null -> mixReleaseName == "";
{
nativeBuildInputs =
nativeBuildInputs
++
# Erlang/Elixir deps
[
erlang
elixir
hex
bbe
findutils
git
makeWrapper
ripgrep
writableTmpDirAsHomeHook
mixBuildDirHook
mixCompileHook
mixDepsCompileHook
]
++ lib.optionals (escriptBinName != null) [ mixEscriptSetupHook ]
++ lib.optionals (escriptBinName == null) [ mixReleaseSetupHook ]
++ lib.optionals (mixFodDeps != null) [ mixFodDepsSetupHook ]
++ lib.optionals (mixNixDeps != { }) ([ mixNixDepsSetupHook ] ++ (builtins.attrValues mixNixDeps));
buildInputs = [
bashNonInteractive
]
++ buildInputs
++ lib.optionals (escriptBinName != null) [
erlang
];
__structuredAttrs = true;
strictDeps = true;
__darwinAllowLocalNetworking = true;
env = {
MIX_ENV = mixEnv;
MIX_TARGET = mixTarget;
MIX_BUILD_PREFIX = (if mixTarget == "host" then "" else "${mixTarget}_") + "${mixEnv}";
MIX_DEBUG = if enableDebugInfo then 1 else 0;
HEX_OFFLINE = 1;
DEBUG = if enableDebugInfo then 1 else 0; # for Rebar3 compilation
# The API with `mix local.rebar rebar path` makes a copy of the binary
# some older dependencies still use rebar.
MIX_REBAR = "${rebar}/bin/rebar";
MIX_REBAR3 = "${rebar3}/bin/rebar3";
ERL_COMPILER_OPTIONS =
let
options = erlangCompilerOptions ++ lib.optionals erlangDeterministicBuilds [ "deterministic" ];
in
"[${lib.concatStringsSep "," options}]";
LANG = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "C";
LC_CTYPE = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "UTF-8";
}
// (attrs.env or { });
inherit erlang;
mixReleaseRuntimePath = lib.makeBinPath [
coreutils
gnused
gnugrep
gawk
];
}