git.iko.soy/typeable/nixpkgs
on master help sign in
beam: nixpkgs-fmt
commitaf0844c7a2992b7d653a879e1cb1f7257e5957c0 authorhappysalada <raphael@megzari.com> dateThu 3 Jun 2021, 21:58 (5 years ago) parentbd683bb
4 files changed+146−97
pkgs/development/beam-modules/build-erlang-mk.nix+42−34 pkgs/development/beam-modules/build-mix.nix+1−3 pkgs/development/beam-modules/build-rebar3.nix+13−9 pkgs/development/interpreters/erlang/generic-builder.nix+90−51
pkgs/development/beam-modules/build-erlang-mk.nix+42−34
@@ -1,19 +1,21 @@
11{ stdenv, writeText, erlang, perl, which, gitMinimal, wget, lib }:
22
3−{ name, version
3+{ name
4+, version
45, src
56, setupHook ? null
6−, buildInputs ? []
7−, beamDeps ? []
7+, buildInputs ? [ ]
8+, beamDeps ? [ ]
89, postPatch ? ""
910, compilePorts ? false
1011, installPhase ? null
1112, buildPhase ? null
1213, configurePhase ? null
13−, meta ? {}
14+, meta ? { }
1415, enableDebugInfo ? false
15−, buildFlags ? []
16−, ... }@attrs:
16+, buildFlags ? [ ]
17+, ...
18+}@attrs:
1719
1820with lib;
1921
@@ -21,11 +23,11 @@ let
2123 debugInfoFlag = lib.optionalString (enableDebugInfo || erlang.debugInfo) "+debug_info";
2224
2325 shell = drv: stdenv.mkDerivation {
24− name = "interactive-shell-${drv.name}";
25− buildInputs = [ drv ];
26− };
26+ name = "interactive-shell-${drv.name}";
27+ buildInputs = [ drv ];
28+ };
2729
28− pkg = self: stdenv.mkDerivation ( attrs // {
30+ pkg = self: stdenv.mkDerivation (attrs // {
2931 app_name = name;
3032 name = "${name}-${version}";
3133 inherit version;
@@ -34,11 +36,13 @@ let
3436
3537 inherit src;
3638
37− setupHook = if setupHook == null
38− then writeText "setupHook.sh" ''
39− addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
40− ''
41− else setupHook;
39+ setupHook =
40+ if setupHook == null
41+ then
42+ writeText "setupHook.sh" ''
43+ addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
44+ ''
45+ else setupHook;
4246
4347 buildInputs = buildInputs ++ [ erlang perl which gitMinimal wget ];
4448 propagatedBuildInputs = beamDeps;
@@ -47,30 +51,33 @@ let
4751 ++ lib.optional (enableDebugInfo || erlang.debugInfo) ''ERL_OPTS="$ERL_OPTS +debug_info"''
4852 ++ buildFlags;
4953
50− configurePhase = if configurePhase == null
51− then ''
52− runHook preConfigure
54+ configurePhase =
55+ if configurePhase == null
56+ then ''
57+ runHook preConfigure
5358
54− # We shouldnt need to do this, but it seems at times there is a *.app in
55− # the repo/package. This ensures we start from a clean slate
56− make SKIP_DEPS=1 clean
59+ # We shouldnt need to do this, but it seems at times there is a *.app in
60+ # the repo/package. This ensures we start from a clean slate
61+ make SKIP_DEPS=1 clean
5762
58− runHook postConfigure
59− ''
60− else configurePhase;
63+ runHook postConfigure
64+ ''
65+ else configurePhase;
6166
62− buildPhase = if buildPhase == null
63− then ''
67+ buildPhase =
68+ if buildPhase == null
69+ then ''
6470 runHook preBuild
6571
6672 make $buildFlags "''${buildFlagsArray[@]}"
6773
6874 runHook postBuild
69− ''
70− else buildPhase;
75+ ''
76+ else buildPhase;
7177
72− installPhase = if installPhase == null
73− then ''
78+ installPhase =
79+ if installPhase == null
80+ then ''
7481 runHook preInstall
7582
7683 mkdir -p $out/lib/erlang/lib/${name}
@@ -90,13 +97,14 @@ let
9097 fi
9198
9299 runHook postInstall
93− ''
94− else installPhase;
100+ ''
101+ else installPhase;
95102
96103 passthru = {
97104 packageName = name;
98105 env = shell self;
99106 inherit beamDeps;
100107 };
101−});
102−in fix pkg
108+ });
109+in
110+fix pkg
pkgs/development/beam-modules/build-mix.nix+1−3
@@ -35,9 +35,7 @@ let
3535
3636 # add to ERL_LIBS so other modules can find at runtime.
3737 # http://erlang.org/doc/man/code.html#code-path
38− # Mix also searches the code path when compiling with the --no-deps-check
39− # flag, which is why there is no complicated booterstrapper like the one
40− # used by buildRebar3.
38+ # Mix also searches the code path when compiling with the --no-deps-check flag
4139 setupHook = attrs.setupHook or
4240 writeText "setupHook.sh" ''
4341 addToSearchPath ERL_LIBS "$1/lib/erlang/lib"
pkgs/development/beam-modules/build-rebar3.nix+13−9
@@ -1,16 +1,20 @@
11{ stdenv, writeText, erlang, rebar3WithPlugins, openssl, libyaml, lib }:
22
3−{ name, version
3+{ name
4+, version
45, src
56, setupHook ? null
6−, buildInputs ? [], beamDeps ? [], buildPlugins ? []
7+, buildInputs ? [ ]
8+, beamDeps ? [ ]
9+, buildPlugins ? [ ]
710, postPatch ? ""
811, installPhase ? null
912, buildPhase ? null
1013, configurePhase ? null
11−, meta ? {}
14+, meta ? { }
1215, enableDebugInfo ? false
13−, ... }@attrs:
16+, ...
17+}@attrs:
1418
1519with lib;
1620
@@ -22,9 +26,9 @@ let
2226 };
2327
2428 shell = drv: stdenv.mkDerivation {
25− name = "interactive-shell-${drv.name}";
26− buildInputs = [ drv ];
27− };
29+ name = "interactive-shell-${drv.name}";
30+ buildInputs = [ drv ];
31+ };
2832
2933 customPhases = filterAttrs
3034 (_: v: v != null)
@@ -42,7 +46,7 @@ let
4246 inherit src;
4347
4448 setupHook = writeText "setupHook.sh" ''
45− addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
49+ addToSearchPath ERL_LIBS "$1/lib/erlang/lib/"
4650 '';
4751
4852 postPatch = ''
@@ -77,4 +81,4 @@ let
7781 };
7882 } // customPhases);
7983in
80− fix pkg
84+fix pkg
pkgs/development/interpreters/erlang/generic-builder.nix+90−51
@@ -1,12 +1,32 @@
1−{ pkgs, lib, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused
2−, libxml2, libxslt, ncurses, openssl, perl, autoconf
1+{ pkgs
2+, lib
3+, stdenv
4+, fetchFromGitHub
5+, makeWrapper
6+, gawk
7+, gnum4
8+, gnused
9+, libxml2
10+, libxslt
11+, ncurses
12+, openssl
13+, perl
14+, autoconf
315, openjdk11 ? null # javacSupport
416, unixODBC ? null # odbcSupport
5−, libGL ? null, libGLU ? null, wxGTK ? null, wxmac ? null, xorg ? null
17+, libGL ? null
18+, libGLU ? null
19+, wxGTK ? null
20+, wxmac ? null
21+, xorg ? null
622, parallelBuild ? false
7−, systemd, wxSupport ? true
8−# updateScript deps
9−, writeScript, common-updater-scripts, coreutils, git
23+, systemd
24+, wxSupport ? true
25+ # updateScript deps
26+, writeScript
27+, common-updater-scripts
28+, coreutils
29+, git
1030}:
1131{ baseName ? "erlang"
1232, version
@@ -18,25 +38,42 @@
1838, enableThreads ? true
1939, enableSmpSupport ? true
2040, enableKernelPoll ? true
21−, javacSupport ? false, javacPackages ? [ openjdk11 ]
22−, odbcSupport ? false, odbcPackages ? [ unixODBC ]
41+, javacSupport ? false
42+, javacPackages ? [ openjdk11 ]
43+, odbcSupport ? false
44+, odbcPackages ? [ unixODBC ]
2345, withSystemd ? stdenv.isLinux # systemd support in epmd
2446, opensslPackage ? openssl
2547, wxPackages ? [ libGL libGLU wxGTK xorg.libX11 ]
26−, preUnpack ? "", postUnpack ? ""
27−, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? ""
28−, configureFlags ? [], configurePhase ? "", preConfigure ? "", postConfigure ? ""
29−, buildPhase ? "", preBuild ? "", postBuild ? ""
30−, installPhase ? "", preInstall ? "", postInstall ? ""
48+, preUnpack ? ""
49+, postUnpack ? ""
50+, patches ? [ ]
51+, patchPhase ? ""
52+, prePatch ? ""
53+, postPatch ? ""
54+, configureFlags ? [ ]
55+, configurePhase ? ""
56+, preConfigure ? ""
57+, postConfigure ? ""
58+, buildPhase ? ""
59+, preBuild ? ""
60+, postBuild ? ""
61+, installPhase ? ""
62+, preInstall ? ""
63+, postInstall ? ""
3164, installTargets ? [ "install" "install-docs" ]
32−, checkPhase ? "", preCheck ? "", postCheck ? ""
33−, fixupPhase ? "", preFixup ? "", postFixup ? ""
34−, meta ? {}
65+, checkPhase ? ""
66+, preCheck ? ""
67+, postCheck ? ""
68+, fixupPhase ? ""
69+, preFixup ? ""
70+, postFixup ? ""
71+, meta ? { }
3572}:
3673
3774assert wxSupport -> (if stdenv.isDarwin
38− then wxmac != null
39− else libGL != null && libGLU != null && wxGTK != null && xorg != null);
75+then wxmac != null
76+else libGL != null && libGLU != null && wxGTK != null && xorg != null);
4077
4178assert odbcSupport -> unixODBC != null;
4279assert javacSupport -> openjdk11 != null;
@@ -45,7 +82,8 @@ let
4582 inherit (lib) optional optionals optionalAttrs optionalString;
4683 wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages;
4784
48−in stdenv.mkDerivation ({
85+in
86+stdenv.mkDerivation ({
4987 name = "${baseName}-${version}"
5088 + optionalString javacSupport "-javac"
5189 + optionalString odbcSupport "-odbc";
@@ -109,19 +147,20 @@ in stdenv.mkDerivation ({
109147 passthru = {
110148 updateScript =
111149 let major = builtins.head (builtins.splitVersion version);
112− in writeScript "update.sh" ''
113− #!${stdenv.shell}
114− set -ox errexit
115− PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
116− latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
117− if [ "$latest" != "${version}" ]; then
118− nixpkgs="$(git rev-parse --show-toplevel)"
119− nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
120− update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
121− else
122− echo "${baseName}R${major} is already up-to-date"
123− fi
124− '';
150+ in
151+ writeScript "update.sh" ''
152+ #!${stdenv.shell}
153+ set -ox errexit
154+ PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
155+ latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
156+ if [ "$latest" != "${version}" ]; then
157+ nixpkgs="$(git rev-parse --show-toplevel)"
158+ nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
159+ update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
160+ else
161+ echo "${baseName}R${major} is already up-to-date"
162+ fi
163+ '';
125164 };
126165
127166 meta = with lib; ({
@@ -143,24 +182,24 @@ in stdenv.mkDerivation ({
143182 license = licenses.asl20;
144183 } // meta);
145184}
146−// optionalAttrs (preUnpack != "") { inherit preUnpack; }
147−// optionalAttrs (postUnpack != "") { inherit postUnpack; }
148−// optionalAttrs (patches != []) { inherit patches; }
149−// optionalAttrs (prePatch != "") { inherit prePatch; }
150−// optionalAttrs (patchPhase != "") { inherit patchPhase; }
185+// optionalAttrs (preUnpack != "") { inherit preUnpack; }
186+// optionalAttrs (postUnpack != "") { inherit postUnpack; }
187+// optionalAttrs (patches != [ ]) { inherit patches; }
188+// optionalAttrs (prePatch != "") { inherit prePatch; }
189+// optionalAttrs (patchPhase != "") { inherit patchPhase; }
151190// optionalAttrs (configurePhase != "") { inherit configurePhase; }
152−// optionalAttrs (preConfigure != "") { inherit preConfigure; }
153−// optionalAttrs (postConfigure != "") { inherit postConfigure; }
154−// optionalAttrs (buildPhase != "") { inherit buildPhase; }
155−// optionalAttrs (preBuild != "") { inherit preBuild; }
156−// optionalAttrs (postBuild != "") { inherit postBuild; }
157−// optionalAttrs (checkPhase != "") { inherit checkPhase; }
158−// optionalAttrs (preCheck != "") { inherit preCheck; }
159−// optionalAttrs (postCheck != "") { inherit postCheck; }
160−// optionalAttrs (installPhase != "") { inherit installPhase; }
161−// optionalAttrs (installTargets != []) { inherit installTargets; }
162−// optionalAttrs (preInstall != "") { inherit preInstall; }
163−// optionalAttrs (fixupPhase != "") { inherit fixupPhase; }
164−// optionalAttrs (preFixup != "") { inherit preFixup; }
165−// optionalAttrs (postFixup != "") { inherit postFixup; }
191+// optionalAttrs (preConfigure != "") { inherit preConfigure; }
192+// optionalAttrs (postConfigure != "") { inherit postConfigure; }
193+// optionalAttrs (buildPhase != "") { inherit buildPhase; }
194+// optionalAttrs (preBuild != "") { inherit preBuild; }
195+// optionalAttrs (postBuild != "") { inherit postBuild; }
196+// optionalAttrs (checkPhase != "") { inherit checkPhase; }
197+// optionalAttrs (preCheck != "") { inherit preCheck; }
198+// optionalAttrs (postCheck != "") { inherit postCheck; }
199+// optionalAttrs (installPhase != "") { inherit installPhase; }
200+// optionalAttrs (installTargets != [ ]) { inherit installTargets; }
201+// optionalAttrs (preInstall != "") { inherit preInstall; }
202+// optionalAttrs (fixupPhase != "") { inherit fixupPhase; }
203+// optionalAttrs (preFixup != "") { inherit preFixup; }
204+// optionalAttrs (postFixup != "") { inherit postFixup; }
166205)