diff options
author | happysalada <raphael@megzari.com> | 2021-05-19 13:59:52 +0900 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-05-25 07:36:38 +0900 |
commit | 72a1b62b472025ed3bd716fce8a102cad81cbd04 (patch) | |
tree | 135c830e7304538a8144475d4c78c82ff3ef9604 /pkgs/development/beam-modules/mix-release.nix | |
parent | 5ba789eeca29a85144d1b611e52d09b132bedd91 (diff) | |
download | nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar.gz nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar.bz2 nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar.lz nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar.xz nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.tar.zst nixpkgs-72a1b62b472025ed3bd716fce8a102cad81cbd04.zip |
mixRelease: integrate mix2nix
Diffstat (limited to 'pkgs/development/beam-modules/mix-release.nix')
-rw-r--r-- | pkgs/development/beam-modules/mix-release.nix | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/pkgs/development/beam-modules/mix-release.nix b/pkgs/development/beam-modules/mix-release.nix index 320fcaa9c9b..774af2e5ec9 100644 --- a/pkgs/development/beam-modules/mix-release.nix +++ b/pkgs/development/beam-modules/mix-release.nix @@ -8,15 +8,23 @@ , enableDebugInfo ? false , mixEnv ? "prod" , compileFlags ? [ ] -, mixDeps ? null + # mix fixed output derivation dependencies +, 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 will find dependencies +, mixNixDeps ? { } , ... }@attrs: let - overridable = builtins.removeAttrs attrs [ "compileFlags" ]; - + # remove non standard attributes that cannot be coerced to strings + overridable = builtins.removeAttrs attrs [ "compileFlags" "mixNixDeps" ]; in +assert mixNixDeps != { } -> mixFodDeps == null; stdenv.mkDerivation (overridable // { nativeBuildInputs = nativeBuildInputs ++ [ erlang hex elixir makeWrapper git ]; + buildInputs = builtins.attrValues mixNixDeps; MIX_ENV = mixEnv; MIX_DEBUG = if enableDebugInfo then 1 else 0; @@ -29,17 +37,17 @@ stdenv.mkDerivation (overridable // { postUnpack = '' export HEX_HOME="$TEMPDIR/hex" export MIX_HOME="$TEMPDIR/mix" - # compilation of the dependencies will require - # that the dependency path is writable - # thus a copy to the TEMPDIR is inevitable here - export MIX_DEPS_PATH="$TEMPDIR/deps" # Rebar export REBAR_GLOBAL_CONFIG_DIR="$TEMPDIR/rebar3" export REBAR_CACHE_DIR="$TEMPDIR/rebar3.cache" - ${lib.optionalString (mixDeps != null) '' - cp --no-preserve=mode -R "${mixDeps}" "$MIX_DEPS_PATH" + ${lib.optionalString (mixFodDeps != null) '' + # compilation of the dependencies will require + # that the dependency path is writable + # thus a copy to the TEMPDIR is inevitable here + export MIX_DEPS_PATH="$TEMPDIR/deps" + cp --no-preserve=mode -R "${mixFodDeps}" "$MIX_DEPS_PATH" '' } |