beam: nixpkgs-fmt
This commit is contained in:
parent
bd683bb1ef
commit
af0844c7a2
|
@ -1,19 +1,21 @@
|
||||||
{ stdenv, writeText, erlang, perl, which, gitMinimal, wget, lib }:
|
{ stdenv, writeText, erlang, perl, which, gitMinimal, wget, lib }:
|
||||||
|
|
||||||
{ name, version
|
{ name
|
||||||
|
, version
|
||||||
, src
|
, src
|
||||||
, setupHook ? null
|
, setupHook ? null
|
||||||
, buildInputs ? []
|
, buildInputs ? [ ]
|
||||||
, beamDeps ? []
|
, beamDeps ? [ ]
|
||||||
, postPatch ? ""
|
, postPatch ? ""
|
||||||
, compilePorts ? false
|
, compilePorts ? false
|
||||||
, installPhase ? null
|
, installPhase ? null
|
||||||
, buildPhase ? null
|
, buildPhase ? null
|
||||||
, configurePhase ? null
|
, configurePhase ? null
|
||||||
, meta ? {}
|
, meta ? { }
|
||||||
, enableDebugInfo ? false
|
, enableDebugInfo ? false
|
||||||
, buildFlags ? []
|
, buildFlags ? [ ]
|
||||||
, ... }@attrs:
|
, ...
|
||||||
|
}@attrs:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
@ -21,11 +23,11 @@ let
|
||||||
debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "+debug_info";
|
debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "+debug_info";
|
||||||
|
|
||||||
shell = drv: stdenv.mkDerivation {
|
shell = drv: stdenv.mkDerivation {
|
||||||
name = "interactive-shell-${drv.name}";
|
name = "interactive-shell-${drv.name}";
|
||||||
buildInputs = [ drv ];
|
buildInputs = [ drv ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pkg = self: stdenv.mkDerivation ( attrs // {
|
pkg = self: stdenv.mkDerivation (attrs // {
|
||||||
app_name = name;
|
app_name = name;
|
||||||
name = "${name}-${version}";
|
name = "${name}-${version}";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
@ -34,11 +36,13 @@ let
|
||||||
|
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
setupHook = if setupHook == null
|
setupHook =
|
||||||
then writeText "setupHook.sh" ''
|
if setupHook == null
|
||||||
addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
|
then
|
||||||
''
|
writeText "setupHook.sh" ''
|
||||||
else setupHook;
|
addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
|
||||||
|
''
|
||||||
|
else setupHook;
|
||||||
|
|
||||||
buildInputs = buildInputs ++ [ erlang perl which gitMinimal wget ];
|
buildInputs = buildInputs ++ [ erlang perl which gitMinimal wget ];
|
||||||
propagatedBuildInputs = beamDeps;
|
propagatedBuildInputs = beamDeps;
|
||||||
|
@ -47,30 +51,33 @@ let
|
||||||
++ lib.optional (enableDebugInfo || erlang.debugInfo) ''ERL_OPTS="$ERL_OPTS +debug_info"''
|
++ lib.optional (enableDebugInfo || erlang.debugInfo) ''ERL_OPTS="$ERL_OPTS +debug_info"''
|
||||||
++ buildFlags;
|
++ buildFlags;
|
||||||
|
|
||||||
configurePhase = if configurePhase == null
|
configurePhase =
|
||||||
then ''
|
if configurePhase == null
|
||||||
runHook preConfigure
|
then ''
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
# We shouldnt need to do this, but it seems at times there is a *.app in
|
# We shouldnt need to do this, but it seems at times there is a *.app in
|
||||||
# the repo/package. This ensures we start from a clean slate
|
# the repo/package. This ensures we start from a clean slate
|
||||||
make SKIP_DEPS=1 clean
|
make SKIP_DEPS=1 clean
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
''
|
''
|
||||||
else configurePhase;
|
else configurePhase;
|
||||||
|
|
||||||
buildPhase = if buildPhase == null
|
buildPhase =
|
||||||
then ''
|
if buildPhase == null
|
||||||
|
then ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
make $buildFlags "''${buildFlagsArray[@]}"
|
make $buildFlags "''${buildFlagsArray[@]}"
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
''
|
''
|
||||||
else buildPhase;
|
else buildPhase;
|
||||||
|
|
||||||
installPhase = if installPhase == null
|
installPhase =
|
||||||
then ''
|
if installPhase == null
|
||||||
|
then ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out/lib/erlang/lib/${name}
|
mkdir -p $out/lib/erlang/lib/${name}
|
||||||
|
@ -90,13 +97,14 @@ let
|
||||||
fi
|
fi
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
''
|
''
|
||||||
else installPhase;
|
else installPhase;
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
packageName = name;
|
packageName = name;
|
||||||
env = shell self;
|
env = shell self;
|
||||||
inherit beamDeps;
|
inherit beamDeps;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
in fix pkg
|
in
|
||||||
|
fix pkg
|
||||||
|
|
|
@ -35,9 +35,7 @@ let
|
||||||
|
|
||||||
# add to ERL_LIBS so other modules can find at runtime.
|
# add to ERL_LIBS so other modules can find at runtime.
|
||||||
# http://erlang.org/doc/man/code.html#code-path
|
# http://erlang.org/doc/man/code.html#code-path
|
||||||
# Mix also searches the code path when compiling with the --no-deps-check
|
# Mix also searches the code path when compiling with the --no-deps-check flag
|
||||||
# flag, which is why there is no complicated booterstrapper like the one
|
|
||||||
# used by buildRebar3.
|
|
||||||
setupHook = attrs.setupHook or
|
setupHook = attrs.setupHook or
|
||||||
writeText "setupHook.sh" ''
|
writeText "setupHook.sh" ''
|
||||||
addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
|
addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
|
||||||
|
|
|
@ -1,16 +1,20 @@
|
||||||
{ stdenv, writeText, erlang, rebar3WithPlugins, openssl, libyaml, lib }:
|
{ stdenv, writeText, erlang, rebar3WithPlugins, openssl, libyaml, lib }:
|
||||||
|
|
||||||
{ name, version
|
{ name
|
||||||
|
, version
|
||||||
, src
|
, src
|
||||||
, setupHook ? null
|
, setupHook ? null
|
||||||
, buildInputs ? [], beamDeps ? [], buildPlugins ? []
|
, buildInputs ? [ ]
|
||||||
|
, beamDeps ? [ ]
|
||||||
|
, buildPlugins ? [ ]
|
||||||
, postPatch ? ""
|
, postPatch ? ""
|
||||||
, installPhase ? null
|
, installPhase ? null
|
||||||
, buildPhase ? null
|
, buildPhase ? null
|
||||||
, configurePhase ? null
|
, configurePhase ? null
|
||||||
, meta ? {}
|
, meta ? { }
|
||||||
, enableDebugInfo ? false
|
, enableDebugInfo ? false
|
||||||
, ... }@attrs:
|
, ...
|
||||||
|
}@attrs:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
|
@ -22,9 +26,9 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
shell = drv: stdenv.mkDerivation {
|
shell = drv: stdenv.mkDerivation {
|
||||||
name = "interactive-shell-${drv.name}";
|
name = "interactive-shell-${drv.name}";
|
||||||
buildInputs = [ drv ];
|
buildInputs = [ drv ];
|
||||||
};
|
};
|
||||||
|
|
||||||
customPhases = filterAttrs
|
customPhases = filterAttrs
|
||||||
(_: v: v != null)
|
(_: v: v != null)
|
||||||
|
@ -42,7 +46,7 @@ let
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
setupHook = writeText "setupHook.sh" ''
|
setupHook = writeText "setupHook.sh" ''
|
||||||
addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
|
addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
@ -77,4 +81,4 @@ let
|
||||||
};
|
};
|
||||||
} // customPhases);
|
} // customPhases);
|
||||||
in
|
in
|
||||||
fix pkg
|
fix pkg
|
||||||
|
|
|
@ -1,12 +1,32 @@
|
||||||
{ pkgs, lib, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused
|
{ pkgs
|
||||||
, libxml2, libxslt, ncurses, openssl, perl, autoconf
|
, lib
|
||||||
|
, stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, makeWrapper
|
||||||
|
, gawk
|
||||||
|
, gnum4
|
||||||
|
, gnused
|
||||||
|
, libxml2
|
||||||
|
, libxslt
|
||||||
|
, ncurses
|
||||||
|
, openssl
|
||||||
|
, perl
|
||||||
|
, autoconf
|
||||||
, openjdk11 ? null # javacSupport
|
, openjdk11 ? null # javacSupport
|
||||||
, unixODBC ? null # odbcSupport
|
, unixODBC ? null # odbcSupport
|
||||||
, libGL ? null, libGLU ? null, wxGTK ? null, wxmac ? null, xorg ? null
|
, libGL ? null
|
||||||
|
, libGLU ? null
|
||||||
|
, wxGTK ? null
|
||||||
|
, wxmac ? null
|
||||||
|
, xorg ? null
|
||||||
, parallelBuild ? false
|
, parallelBuild ? false
|
||||||
, systemd, wxSupport ? true
|
, systemd
|
||||||
# updateScript deps
|
, wxSupport ? true
|
||||||
, writeScript, common-updater-scripts, coreutils, git
|
# updateScript deps
|
||||||
|
, writeScript
|
||||||
|
, common-updater-scripts
|
||||||
|
, coreutils
|
||||||
|
, git
|
||||||
}:
|
}:
|
||||||
{ baseName ? "erlang"
|
{ baseName ? "erlang"
|
||||||
, version
|
, version
|
||||||
|
@ -18,25 +38,42 @@
|
||||||
, enableThreads ? true
|
, enableThreads ? true
|
||||||
, enableSmpSupport ? true
|
, enableSmpSupport ? true
|
||||||
, enableKernelPoll ? true
|
, enableKernelPoll ? true
|
||||||
, javacSupport ? false, javacPackages ? [ openjdk11 ]
|
, javacSupport ? false
|
||||||
, odbcSupport ? false, odbcPackages ? [ unixODBC ]
|
, javacPackages ? [ openjdk11 ]
|
||||||
|
, odbcSupport ? false
|
||||||
|
, odbcPackages ? [ unixODBC ]
|
||||||
, withSystemd ? stdenv.isLinux # systemd support in epmd
|
, withSystemd ? stdenv.isLinux # systemd support in epmd
|
||||||
, opensslPackage ? openssl
|
, opensslPackage ? openssl
|
||||||
, wxPackages ? [ libGL libGLU wxGTK xorg.libX11 ]
|
, wxPackages ? [ libGL libGLU wxGTK xorg.libX11 ]
|
||||||
, preUnpack ? "", postUnpack ? ""
|
, preUnpack ? ""
|
||||||
, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? ""
|
, postUnpack ? ""
|
||||||
, configureFlags ? [], configurePhase ? "", preConfigure ? "", postConfigure ? ""
|
, patches ? [ ]
|
||||||
, buildPhase ? "", preBuild ? "", postBuild ? ""
|
, patchPhase ? ""
|
||||||
, installPhase ? "", preInstall ? "", postInstall ? ""
|
, prePatch ? ""
|
||||||
|
, postPatch ? ""
|
||||||
|
, configureFlags ? [ ]
|
||||||
|
, configurePhase ? ""
|
||||||
|
, preConfigure ? ""
|
||||||
|
, postConfigure ? ""
|
||||||
|
, buildPhase ? ""
|
||||||
|
, preBuild ? ""
|
||||||
|
, postBuild ? ""
|
||||||
|
, installPhase ? ""
|
||||||
|
, preInstall ? ""
|
||||||
|
, postInstall ? ""
|
||||||
, installTargets ? [ "install" "install-docs" ]
|
, installTargets ? [ "install" "install-docs" ]
|
||||||
, checkPhase ? "", preCheck ? "", postCheck ? ""
|
, checkPhase ? ""
|
||||||
, fixupPhase ? "", preFixup ? "", postFixup ? ""
|
, preCheck ? ""
|
||||||
, meta ? {}
|
, postCheck ? ""
|
||||||
|
, fixupPhase ? ""
|
||||||
|
, preFixup ? ""
|
||||||
|
, postFixup ? ""
|
||||||
|
, meta ? { }
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert wxSupport -> (if stdenv.isDarwin
|
assert wxSupport -> (if stdenv.isDarwin
|
||||||
then wxmac != null
|
then wxmac != null
|
||||||
else libGL != null && libGLU != null && wxGTK != null && xorg != null);
|
else libGL != null && libGLU != null && wxGTK != null && xorg != null);
|
||||||
|
|
||||||
assert odbcSupport -> unixODBC != null;
|
assert odbcSupport -> unixODBC != null;
|
||||||
assert javacSupport -> openjdk11 != null;
|
assert javacSupport -> openjdk11 != null;
|
||||||
|
@ -45,7 +82,8 @@ let
|
||||||
inherit (lib) optional optionals optionalAttrs optionalString;
|
inherit (lib) optional optionals optionalAttrs optionalString;
|
||||||
wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages;
|
wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages;
|
||||||
|
|
||||||
in stdenv.mkDerivation ({
|
in
|
||||||
|
stdenv.mkDerivation ({
|
||||||
name = "${baseName}-${version}"
|
name = "${baseName}-${version}"
|
||||||
+ optionalString javacSupport "-javac"
|
+ optionalString javacSupport "-javac"
|
||||||
+ optionalString odbcSupport "-odbc";
|
+ optionalString odbcSupport "-odbc";
|
||||||
|
@ -109,19 +147,20 @@ in stdenv.mkDerivation ({
|
||||||
passthru = {
|
passthru = {
|
||||||
updateScript =
|
updateScript =
|
||||||
let major = builtins.head (builtins.splitVersion version);
|
let major = builtins.head (builtins.splitVersion version);
|
||||||
in writeScript "update.sh" ''
|
in
|
||||||
#!${stdenv.shell}
|
writeScript "update.sh" ''
|
||||||
set -ox errexit
|
#!${stdenv.shell}
|
||||||
PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
|
set -ox errexit
|
||||||
latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
|
||||||
if [ "$latest" != "${version}" ]; then
|
latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
|
||||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
if [ "$latest" != "${version}" ]; then
|
||||||
nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||||
update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
|
nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
|
||||||
else
|
update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
|
||||||
echo "${baseName}R${major} is already up-to-date"
|
else
|
||||||
fi
|
echo "${baseName}R${major} is already up-to-date"
|
||||||
'';
|
fi
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; ({
|
meta = with lib; ({
|
||||||
|
@ -143,24 +182,24 @@ in stdenv.mkDerivation ({
|
||||||
license = licenses.asl20;
|
license = licenses.asl20;
|
||||||
} // meta);
|
} // meta);
|
||||||
}
|
}
|
||||||
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
||||||
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
||||||
// optionalAttrs (patches != []) { inherit patches; }
|
// optionalAttrs (patches != [ ]) { inherit patches; }
|
||||||
// optionalAttrs (prePatch != "") { inherit prePatch; }
|
// optionalAttrs (prePatch != "") { inherit prePatch; }
|
||||||
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
||||||
// optionalAttrs (configurePhase != "") { inherit configurePhase; }
|
// optionalAttrs (configurePhase != "") { inherit configurePhase; }
|
||||||
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
|
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
|
||||||
// optionalAttrs (postConfigure != "") { inherit postConfigure; }
|
// optionalAttrs (postConfigure != "") { inherit postConfigure; }
|
||||||
// optionalAttrs (buildPhase != "") { inherit buildPhase; }
|
// optionalAttrs (buildPhase != "") { inherit buildPhase; }
|
||||||
// optionalAttrs (preBuild != "") { inherit preBuild; }
|
// optionalAttrs (preBuild != "") { inherit preBuild; }
|
||||||
// optionalAttrs (postBuild != "") { inherit postBuild; }
|
// optionalAttrs (postBuild != "") { inherit postBuild; }
|
||||||
// optionalAttrs (checkPhase != "") { inherit checkPhase; }
|
// optionalAttrs (checkPhase != "") { inherit checkPhase; }
|
||||||
// optionalAttrs (preCheck != "") { inherit preCheck; }
|
// optionalAttrs (preCheck != "") { inherit preCheck; }
|
||||||
// optionalAttrs (postCheck != "") { inherit postCheck; }
|
// optionalAttrs (postCheck != "") { inherit postCheck; }
|
||||||
// optionalAttrs (installPhase != "") { inherit installPhase; }
|
// optionalAttrs (installPhase != "") { inherit installPhase; }
|
||||||
// optionalAttrs (installTargets != []) { inherit installTargets; }
|
// optionalAttrs (installTargets != [ ]) { inherit installTargets; }
|
||||||
// optionalAttrs (preInstall != "") { inherit preInstall; }
|
// optionalAttrs (preInstall != "") { inherit preInstall; }
|
||||||
// optionalAttrs (fixupPhase != "") { inherit fixupPhase; }
|
// optionalAttrs (fixupPhase != "") { inherit fixupPhase; }
|
||||||
// optionalAttrs (preFixup != "") { inherit preFixup; }
|
// optionalAttrs (preFixup != "") { inherit preFixup; }
|
||||||
// optionalAttrs (postFixup != "") { inherit postFixup; }
|
// optionalAttrs (postFixup != "") { inherit postFixup; }
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue