diff options
Diffstat (limited to 'pkgs/development/tools/build-managers')
15 files changed, 273 insertions, 483 deletions
diff --git a/pkgs/development/tools/build-managers/apache-maven/default.nix b/pkgs/development/tools/build-managers/apache-maven/default.nix index 3a1866e0b399..9e0103170e9f 100644 --- a/pkgs/development/tools/build-managers/apache-maven/default.nix +++ b/pkgs/development/tools/build-managers/apache-maven/default.nix @@ -2,16 +2,15 @@ assert jdk != null; -let version = "3.6.3"; in stdenv.mkDerivation rec { pname = "apache-maven"; - inherit version; + version = "3.8.1"; builder = ./builder.sh; src = fetchurl { url = "mirror://apache/maven/maven-3/${version}/binaries/${pname}-${version}-bin.tar.gz"; - sha256 = "1i9qlj3vy4j1yyf22nwisd0pg88n9qzp9ymfhwqabadka7br3b96"; + sha256 = "00pgmc9v2s2970wgl2ksvpqy4lxx17zhjm9fgd10fkamxc2ik2mr"; }; nativeBuildInputs = [ makeWrapper ]; diff --git a/pkgs/development/tools/build-managers/bazel/bazel-remote/default.nix b/pkgs/development/tools/build-managers/bazel/bazel-remote/default.nix index 1dfe784ec254..711b971c2d88 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel-remote/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel-remote/default.nix @@ -1,85 +1,22 @@ -{ buildBazelPackage -, cacert +{ buildGoModule , fetchFromGitHub -, git -, go , lib -, stdenv }: -buildBazelPackage rec { +buildGoModule rec { pname = "bazel-remote"; - version = "1.0.0"; + version = "2.0.1"; src = fetchFromGitHub { owner = "buchgr"; - repo = "bazel-remote"; + repo = pname; rev = "v${version}"; - sha256 = "1fpdw139d5q1377qnqbgkahmdr4mdaa17d2m10wkyvyvijwm4r2m"; + sha256 = "193amcx4nk7mr51jcawym46gizqmfkvksjxm64pf7s3wraf00v01"; }; - nativeBuildInputs = [ go git ]; + vendorSha256 = "1sxv9mya8plkn3hpjgfpzgwlh4m3cbhpywqv86brj2h9i4ad0gl5"; - bazelTarget = "//:bazel-remote"; - - removeRulesCC = false; - - # this is to work around `test -f` failing when called by gazelle - # https://github.com/bazelbuild/bazel-gazelle/blob/v0.19.1/internal/go_repository.bzl#L135 - patches = [ ./disable_build_file_generation.patch ]; - - fetchAttrs = { - preBuild = '' - patchShebangs . - - # tell rules_go to use the Go binary found in the PATH - sed -e 's:go_register_toolchains():go_register_toolchains(go_version = "host"):g' -i WORKSPACE - - # tell rules_go to invoke GIT with custom CAINFO path - export GIT_SSL_CAINFO="${cacert}/etc/ssl/certs/ca-bundle.crt" - - # force gazelle to use the nix go cache rather than its own - # export GO_REPOSITORY_USE_HOST_CACHE=1 - ''; - - preInstall = '' - # Remove the go_sdk (it's just a copy of the go derivation) and all - # references to it from the marker files. Bazel does not need to download - # this sdk because we have patched the WORKSPACE file to point to the one - # currently present in PATH. Without removing the go_sdk from the marker - # file, the hash of it will change anytime the Go derivation changes and - # that would lead to impurities in the marker files which would result in - # a different sha256 for the fetch phase. - rm -rf $bazelOut/external/{go_sdk,\@go_sdk.marker} - sed -e '/^FILE:@go_sdk.*/d' -i $bazelOut/external/\@*.marker - - # Remove the gazelle repository cache as it contains built binaries - chmod -R u+w $bazelOut/external/bazel_gazelle_go_repository_cache - rm -rf $bazelOut/external/{bazel_gazelle_go_repository_cache,\@bazel_gazelle_go_repository_cache.marker} - sed -e '/^FILE:@bazel_gazelle_go_repository_cache.*/d' -i $bazelOut/external/\@*.marker - - # Remove the gazelle tools, they contain go binaries that are built - # non-deterministically. As long as the gazelle version matches the tools - # should be equivalent. - rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker} - sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker - ''; - - sha256 = "1vijh3nl30n8k6xlx6in92pzs70x15akbqiqalk8apgvphvdz8vy"; - }; - - buildAttrs = { - preBuild = '' - patchShebangs . - - # tell rules_go to use the Go binary found in the PATH - sed -e 's:go_register_toolchains():go_register_toolchains(go_version = "host"):g' -i WORKSPACE - ''; - - installPhase = '' - install -Dm755 bazel-bin/*_pure_stripped/bazel-remote $out/bin/bazel-remote - ''; - }; + doCheck = false; meta = with lib; { homepage = "https://github.com/buchgr/bazel-remote"; @@ -87,6 +24,5 @@ buildBazelPackage rec { license = licenses.asl20; maintainers = [ maintainers.uri-canva ]; platforms = platforms.darwin ++ platforms.linux; - broken = stdenv.isDarwin; }; } diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix index 5b20ece76803..fd29102b7e58 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix @@ -371,7 +371,7 @@ stdenv.mkDerivation rec { # libcxx includes aren't added by libcxx hook # https://github.com/NixOS/nixpkgs/pull/41589 - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1" + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1" # don't use system installed Xcode to run clang, use Nix clang instead sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \ diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix index 31dbc2779cde..7fc034220163 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -388,7 +388,7 @@ stdenv.mkDerivation rec { # libcxx includes aren't added by libcxx hook # https://github.com/NixOS/nixpkgs/pull/41589 - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1" + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${lib.getDev libcxx}/include/c++/v1" # don't use system installed Xcode to run clang, use Nix clang instead sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \ diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index d14605074660..b04eac35b05c 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -7,19 +7,14 @@ , useSharedLibraries ? (!isBootstrap && !stdenv.isCygwin) , useOpenSSL ? !isBootstrap, openssl , useNcurses ? false, ncurses -, useQt4 ? false, qt4 , withQt5 ? false, qtbase }: -assert withQt5 -> useQt4 == false; -assert useQt4 -> withQt5 == false; - stdenv.mkDerivation (rec { pname = "cmake" + lib.optionalString isBootstrap "-boot" + lib.optionalString useNcurses "-cursesUI" - + lib.optionalString withQt5 "-qt5UI" - + lib.optionalString useQt4 "-qt4UI"; + + lib.optionalString withQt5 "-qt5UI"; version = "3.19.7"; src = fetchurl { @@ -53,7 +48,6 @@ stdenv.mkDerivation (rec { ++ lib.optionals useSharedLibraries [ bzip2 curlMinimal expat libarchive xz zlib libuv rhash ] ++ lib.optional useOpenSSL openssl ++ lib.optional useNcurses ncurses - ++ lib.optional useQt4 qt4 ++ lib.optional withQt5 qtbase; propagatedBuildInputs = lib.optional stdenv.isDarwin ps; @@ -73,7 +67,7 @@ stdenv.mkDerivation (rec { configureFlags = [ "--docdir=share/doc/${pname}${version}" ] ++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup - ++ lib.optional (useQt4 || withQt5) "--qt-gui" + ++ lib.optional withQt5 "--qt-gui" # Workaround https://gitlab.kitware.com/cmake/cmake/-/issues/20568 ++ lib.optionals stdenv.hostPlatform.is32bit [ "CFLAGS=-D_FILE_OFFSET_BITS=64" @@ -124,7 +118,7 @@ stdenv.mkDerivation (rec { configuration files, and generate native makefiles and workspaces that can be used in the compiler environment of your choice. ''; - platforms = if useQt4 then qt4.meta.platforms else platforms.all; + platforms = platforms.all; maintainers = with maintainers; [ ttuegel lnl7 ]; license = licenses.bsd3; }; diff --git a/pkgs/development/tools/build-managers/conan/default.nix b/pkgs/development/tools/build-managers/conan/default.nix index 0ec9d3ea93e6..9c3e99e23ad6 100644 --- a/pkgs/development/tools/build-managers/conan/default.nix +++ b/pkgs/development/tools/build-managers/conan/default.nix @@ -28,6 +28,17 @@ let newPython = python3.override { sha256 = "18hpzh1am1dqx81fypn57r2wk565fi4g14292qrc5jm1h9dalzld"; }; }); + # https://github.com/conan-io/conan/issues/8876 + pyjwt = super.pyjwt.overridePythonAttrs (oldAttrs: rec { + version = "1.7.1"; + src = oldAttrs.src.override { + inherit version; + sha256 = "8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"; + }; + disabledTests = [ + "test_ec_verify_should_return_false_if_signature_invalid" + ]; + }); }; }; diff --git a/pkgs/development/tools/build-managers/leiningen/default.nix b/pkgs/development/tools/build-managers/leiningen/default.nix index 51b97b242d5c..90b17ed9bba9 100644 --- a/pkgs/development/tools/build-managers/leiningen/default.nix +++ b/pkgs/development/tools/build-managers/leiningen/default.nix @@ -3,17 +3,17 @@ stdenv.mkDerivation rec { pname = "leiningen"; - version = "2.9.5"; + version = "2.9.6"; src = fetchurl { url = "https://raw.github.com/technomancy/leiningen/${version}/bin/lein-pkg"; - sha256 = "12kv3286a2vkm3qpm2msiks87mkspxddgl7bwiacdias9dfda09n"; + sha256 = "0a8lq0yalar8szw155cxa8kywnk6yvakwi3xmxm1ahivn7i5hjq9"; }; jarsrc = fetchurl { # NOTE: This is actually a .jar, Github has issues url = "https://github.com/technomancy/leiningen/releases/download/${version}/${pname}-${version}-standalone.zip"; - sha256 = "1shyvg1471sc3bv4h3ax51626xw8a8w05f43bny6gmp8pyc0qjfz"; + sha256 = "1f3hb57rqp9qkh5n2wf65dvxraf21y15s3g643f2fhzc7vvl7ia1"; }; JARNAME = "${pname}-${version}-standalone.jar"; diff --git a/pkgs/development/tools/build-managers/mill/default.nix b/pkgs/development/tools/build-managers/mill/default.nix index 4538c212da58..4fbd0365af95 100644 --- a/pkgs/development/tools/build-managers/mill/default.nix +++ b/pkgs/development/tools/build-managers/mill/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "mill"; - version = "0.9.5"; + version = "0.9.6"; src = fetchurl { url = "https://github.com/com-lihaoyi/mill/releases/download/${version}/${version}"; - sha256 = "142vr40p60mapvvb5amn8hz6a8930kxsz510baql40hai4yhga7z"; + sha256 = "sha256-cAhcTmSPkV5z5ryuCNrpxy9/1iWvvminiVYul9c/DwM="; }; nativeBuildInputs = [ makeWrapper ]; diff --git a/pkgs/development/tools/build-managers/rebar3/default.nix b/pkgs/development/tools/build-managers/rebar3/default.nix index c2b10d823a30..d6798c2d8e39 100644 --- a/pkgs/development/tools/build-managers/rebar3/default.nix +++ b/pkgs/development/tools/build-managers/rebar3/default.nix @@ -1,137 +1,128 @@ { lib, stdenv, fetchFromGitHub, - fetchHex, erlang, - tree }: + fetchHex, erlang, makeWrapper, + writeScript, common-updater-scripts, coreutils, git, gnused, nix, rebar3-nix }: let - version = "3.14.4"; + version = "3.16.0"; + owner = "erlang"; + deps = import ./rebar-deps.nix { inherit fetchFromGitHub fetchHex; }; + rebar3 = stdenv.mkDerivation rec { + pname = "rebar3"; + inherit version erlang; - # Dependencies should match the ones in: - # https://github.com/erlang/rebar3/blob/${version}/rebar.lock - # `sha256` could also be taken from https://hex.pm - Checksum + # How to obtain `sha256`: + # nix-prefetch-url --unpack https://github.com/erlang/rebar3/archive/${version}.tar.gz + src = fetchFromGitHub { + inherit owner; + repo = pname; + rev = version; + sha256 = "1yqvm37l5rn5dyg4sc2hv47930s2524qrdpnjwy3zqa27r7k5n36"; + }; - bbmustache = fetchHex { - pkg = "bbmustache"; - version = "1.10.0"; - sha256 = "1vp27jqnq65a8iqp7j4z8nw9ad29dhky5agmg8aj75dvshzzmvs3"; - }; - certifi = fetchHex { - pkg = "certifi"; - version = "2.5.3"; - sha256 = "040w1scglvqhcvc1ifdnlcyrbwr0smi00w4xi8h03c99775nllgd"; - }; - cf = fetchHex { - pkg = "cf"; - version = "0.3.1"; - sha256 = "0wknz4xkqkhgvlx4vx5619p8m65v7g87lfgsvfy04jrsgm28spii"; - }; - cth_readable = fetchHex { - pkg = "cth_readable"; - version = "1.5.0"; - sha256 = "0z58b6frqdnhyzrmbdf6x78l3izbbh5z5i3am8hqc253r7xwv0dx"; - }; - erlware_commons = fetchHex { - pkg = "erlware_commons"; - version = "1.4.0"; - sha256 = "1rp2vkgzqm6sax7fc13rh9x6qzxsgg718dnv7l0kmarvyifcyphq"; - }; - eunit_formatters = fetchHex { - pkg = "eunit_formatters"; - version = "0.5.0"; - sha256 = "1jb3hzb216r29x2h4pcjwfmx1k81431rgh5v0mp4x5146hhvmj6n"; - }; - getopt = fetchHex { - pkg = "getopt"; - version = "1.0.1"; - sha256 = "53e1ab83b9ceb65c9672d3e7a35b8092e9bdc9b3ee80721471a161c10c59959c"; - }; - parse_trans = fetchHex { - pkg = "parse_trans"; - version = "3.3.1"; - sha256 = "12w8ai6b5s6b4hnvkav7hwxd846zdd74r32f84nkcmjzi1vrbk87"; - }; + buildInputs = [ erlang ]; - providers = fetchHex { - pkg = "providers"; - version = "1.8.1"; - sha256 = "183b9128l4af60rs40agqh6kc6db33j4027ad6jajxn4x6nlamz4"; - }; - - relx = fetchHex { - pkg = "relx"; - version = "4.3.0"; - sha256 = "0h044arh41sr92r1nlg176shavlv7pvw17alwklhszgwlr4hk3kk"; - }; + postPatch = '' + mkdir -p _checkouts _build/default/lib/ - ssl_verify_fun = fetchHex { - pkg = "ssl_verify_fun"; - version = "1.1.6"; - sha256 = "1026l1z1jh25z8bfrhaw0ryk5gprhrpnirq877zqhg253x3x5c5x"; - }; -in -stdenv.mkDerivation rec { - pname = "rebar3"; - inherit version erlang; + ${toString (lib.mapAttrsToList (k: v: '' + cp -R --no-preserve=mode ${v} _checkouts/${k} + '') deps)} - # How to obtain `sha256`: - # nix-prefetch-url --unpack https://github.com/erlang/rebar3/archive/${version}.tar.gz - src = fetchFromGitHub { - owner = "erlang"; - repo = pname; - rev = version; - sha256 = "09bnqwli93sq1pcz4h88ks7qg7k8yrjy9fd46yyp8xdl7i4irwy2"; - }; + # Bootstrap script expects the dependencies in _build/default/lib + # TODO: Make it accept checkouts? + for i in _checkouts/* ; do + ln -s $(pwd)/$i $(pwd)/_build/default/lib/ + done + ''; - bootstrapper = ./rebar3-nix-bootstrap; + buildPhase = '' + HOME=. escript bootstrap + ''; - buildInputs = [ erlang tree ]; + installPhase = '' + mkdir -p $out/bin + cp rebar3 $out/bin/rebar3 + ''; - postPatch = '' - mkdir -p _checkouts - mkdir -p _build/default/lib/ + meta = { + homepage = "https://github.com/rebar/rebar3"; + description = "Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases"; - cp --no-preserve=mode -R ${bbmustache} _checkouts/bbmustache - cp --no-preserve=mode -R ${certifi} _checkouts/certifi - cp --no-preserve=mode -R ${cf} _checkouts/cf - cp --no-preserve=mode -R ${cth_readable} _checkouts/cth_readable - cp --no-preserve=mode -R ${erlware_commons} _checkouts/erlware_commons - cp --no-preserve=mode -R ${eunit_formatters} _checkouts/eunit_formatters - cp --no-preserve=mode -R ${getopt} _checkouts/getopt - cp --no-preserve=mode -R ${parse_trans} _checkouts/parse_trans - cp --no-preserve=mode -R ${providers} _checkouts/providers - cp --no-preserve=mode -R ${relx} _checkouts/relx - cp --no-preserve=mode -R ${ssl_verify_fun} _checkouts/ssl_verify_fun + longDescription = '' + rebar is a self-contained Erlang script, so it's easy to distribute or + even embed directly in a project. Where possible, rebar uses standard + Erlang/OTP conventions for project structures, thus minimizing the amount + of build configuration work. rebar also provides dependency management, + enabling application writers to easily re-use common libraries from a + variety of locations (hex.pm, git, hg, and so on). + ''; - # Bootstrap script expects the dependencies in _build/default/lib - # TODO: Make it accept checkouts? - for i in _checkouts/* ; do - ln -s $(pwd)/$i $(pwd)/_build/default/lib/ - done - ''; + platforms = lib.platforms.unix; + maintainers = lib.teams.beam.members; + license = lib.licenses.asl20; + }; - buildPhase = '' - HOME=. escript bootstrap - ''; + passthru.updateScript = writeScript "update.sh" '' + #!${stdenv.shell} + set -ox errexit + PATH=${ + lib.makeBinPath [ + common-updater-scripts + coreutils + git + gnused + nix + (rebar3WithPlugins { globalPlugins = [rebar3-nix]; }) + ] + } + latest=$(list-git-tags https://github.com/${owner}/${pname}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1) + if [ "$latest" != "${version}" ]; then + nixpkgs="$(git rev-parse --show-toplevel)" + nix_path="$nixpkgs/pkgs/development/tools/build-managers/rebar3" + update-source-version rebar3 "$latest" --version-key=version --print-changes --file="$nix_path/default.nix" + tmpdir=$(mktemp -d) + cp -R $(nix-build $nixpkgs --no-out-link -A rebar3.src)/* "$tmpdir" + (cd "$tmpdir" && rebar3 nix lock -o "$nix_path/rebar-deps.nix") + else + echo "rebar3 is already up-to-date" + fi + ''; + }; + rebar3WithPlugins = { plugins ? [ ], globalPlugins ? [ ] }: + let + pluginLibDirs = map (p: "${p}/lib/erlang/lib") (lib.unique (plugins ++ globalPlugins)); + globalPluginNames = lib.unique (map (p: p.packageName) globalPlugins); + rebar3Patched = (rebar3.overrideAttrs (old: { - installPhase = '' - mkdir -p $out/bin - cp rebar3 $out/bin/rebar3 - ''; + # skip-plugins.patch is necessary because otherwise rebar3 will always + # try to fetch plugins if they are not already present in _build. + # + # global-deps.patch makes it possible to use REBAR_GLOBAL_PLUGINS to + # instruct rebar3 to always load a certain plugin. It is necessary since + # REBAR_GLOBAL_CONFIG_DIR doesn't seem to work for this. + patches = [ ./skip-plugins.patch ./global-plugins.patch ]; + })); + in stdenv.mkDerivation { + pname = "rebar3-with-plugins"; + inherit (rebar3) version; + nativeBuildInputs = [ erlang makeWrapper ]; + unpackPhase = "true"; - meta = { - homepage = "https://github.com/rebar/rebar3"; - description = "Erlang build tool that makes it easy to compile and test Erlang applications, port drivers and releases"; + # Here we extract the rebar3 escript (like `rebar3_prv_local_install.erl`) and + # add plugins to the code path. - longDescription = '' - rebar is a self-contained Erlang script, so it's easy to distribute or - even embed directly in a project. Where possible, rebar uses standard - Erlang/OTP conventions for project structures, thus minimizing the amount - of build configuration work. rebar also provides dependency management, - enabling application writers to easily re-use common libraries from a - variety of locations (hex.pm, git, hg, and so on). + installPhase = '' + erl -noshell -eval ' + {ok, Escript} = escript:extract("${rebar3Patched}/bin/rebar3", []), + {archive, Archive} = lists:keyfind(archive, 1, Escript), + {ok, _} = zip:extract(Archive, [{cwd, "'$out/lib'"}]), + init:stop(0) + ' + mkdir -p $out/bin + makeWrapper ${erlang}/bin/erl $out/bin/rebar3 \ + --set REBAR_GLOBAL_PLUGINS "${toString globalPluginNames}" \ + --suffix-each ERL_LIBS ":" "$out/lib ${toString pluginLibDirs}" \ + --add-flags "+sbtu +A1 -noshell -boot start_clean -s rebar3 main -extra" ''; - - platforms = lib.platforms.unix; - maintainers = lib.teams.beam.members; - license = lib.licenses.asl20; - }; -} + }; +in { inherit rebar3 rebar3WithPlugins; } diff --git a/pkgs/development/tools/build-managers/rebar3/global-plugins.patch b/pkgs/development/tools/build-managers/rebar3/global-plugins.patch new file mode 100644 index 000000000000..9a8bb48f988a --- /dev/null +++ b/pkgs/development/tools/build-managers/rebar3/global-plugins.patch @@ -0,0 +1,14 @@ +diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl +index f2d22233..bee2cf18 100644 +--- a/src/rebar_plugins.erl ++++ b/src/rebar_plugins.erl +@@ -30,7 +30,8 @@ project_plugins_install(State) -> + top_level_install(State) -> + Profiles = rebar_state:current_profiles(State), + lists:foldl(fun(Profile, StateAcc) -> +- Plugins = rebar_state:get(State, {plugins, Profile}, []), ++ Plugins = rebar_state:get(State, {plugins, Profile}, []) ++ ++ [list_to_atom(P) || P <- string:lexemes(os:getenv("REBAR_GLOBAL_PLUGINS", ""), " ")], + handle_plugins(Profile, Plugins, StateAcc) + end, State, Profiles). + diff --git a/pkgs/development/tools/build-managers/rebar3/rebar-deps.nix b/pkgs/development/tools/build-managers/rebar3/rebar-deps.nix new file mode 100644 index 000000000000..6894b8666e68 --- /dev/null +++ b/pkgs/development/tools/build-managers/rebar3/rebar-deps.nix @@ -0,0 +1,54 @@ +# Generated by rebar3_nix +{ fetchHex, fetchFromGitHub }: +{ + ssl_verify_fun = fetchHex { + pkg = "ssl_verify_fun"; + version = "1.1.6"; + sha256 = "sha256-vbDSRx9FPIj/OQjnaG+G+b4yfQZcwewW+kVAGX6gRoA="; + }; + relx = fetchHex { + pkg = "relx"; + version = "4.4.0"; + sha256 = "sha256-VcDtY7tdVeuYOhnrlNfzB1320Sbb3/QxAqZmCpH86SU="; + }; + providers = fetchHex { + pkg = "providers"; + version = "1.8.1"; + sha256 = "sha256-5FdFrenEdqmkaeoIQOQYqxk2DcRPAaIzME4RikRIa6A="; + }; + getopt = fetchHex { + pkg = "getopt"; + version = "1.0.1"; + sha256 = "sha256-U+Grg7nOtlyWctPno1uAkum9ybPugHIUcaFhwQxZlZw="; + }; + eunit_formatters = fetchHex { + pkg = "eunit_formatters"; + version = "0.5.0"; + sha256 = "sha256-1si6ITQklE5uBbvAl8MgAc3Qq+OSXQJFTyKbINaHY8k="; + }; + erlware_commons = fetchHex { + pkg = "erlware_commons"; + version = "1.5.0"; + sha256 = "sha256-PnxvsrpMKbDdXf6dAxtmRJ4giOzsGoFGW9n94F7X0Ns="; + }; + cth_readable = fetchHex { + pkg = "cth_readable"; + version = "1.5.1"; + sha256 = "sha256-aGVBoi7+bKWkGgR7OVFsLdKPs8reXySi8ZFFs5Z/nYA="; + }; + cf = fetchHex { + pkg = "cf"; + version = "0.3.1"; + sha256 = "sha256-MV6NRH06SwK82/o5etA7u5iKbgqm9E063Q9OPDv5dnI="; + }; + certifi = fetchHex { + pkg = "certifi"; + version = "2.6.1"; + sha256 = "sha256-UkyXtJkbOEndXBemMSI4licsawr0RneLpGdaHf9Tu34="; + }; + bbmustache = fetchHex { + pkg = "bbmustache"; + version = "1.10.0"; + sha256 = "sha256-Q+/6P9S7lSMVevWp4idsSTSVuEWfyHNxRKoYbLE84u4="; + }; +} diff --git a/pkgs/development/tools/build-managers/rebar3/rebar3-nix-bootstrap b/pkgs/development/tools/build-managers/rebar3/rebar3-nix-bootstrap deleted file mode 100755 index f1deed1df352..000000000000 --- a/pkgs/development/tools/build-managers/rebar3/rebar3-nix-bootstrap +++ /dev/null @@ -1,267 +0,0 @@ -#!/usr/bin/env escript -%% -*- erlang-indent-level: 4;indent-tabs-mode: nil -*- -%%! -smp enable -%%% --------------------------------------------------------------------------- -%%% @doc -%%% The purpose of this command is to prepare a rebar3 project so that -%%% rebar3 understands that the dependencies are all already -%%% installed. If you want a hygienic build on nix then you must run -%%% this command before running rebar3. I suggest that you add a -%%% `Makefile` to your project and have the bootstrap command be a -%%% dependency of the build commands. See the nix documentation for -%%% more information. -%%% -%%% This command designed to have as few dependencies as possible so -%%% that it can be a dependency of root level packages like rebar3. To -%%% that end it does many things in a fairly simplistic way. That is -%%% by design. -%%% -%%% ### Assumptions -%%% -%%% This command makes the following assumptions: -%%% -%%% * It is run in a nix-shell or nix-build environment -%%% * that all dependencies have been added to the ERL_LIBS -%%% Environment Variable - --record(data, {version - , debug_info = false - , compile_ports - , erl_libs - , plugins - , root - , name}). - --define(HEX_REGISTRY_PATH, ".cache/rebar3/hex/default/registry"). - -main(Args) -> - {ok, ArgData} = parse_args(Args), - {ok, RequiredData} = gather_required_data_from_the_environment(ArgData), - do_the_bootstrap(RequiredData). - --spec do_the_bootstrap(#data{}) -> ok. -do_the_bootstrap(RequiredData) -> - ok = bootstrap_configs(RequiredData), - ok = bootstrap_plugins(RequiredData), - ok = bootstrap_libs(RequiredData). - -%% @doc -%% Argument parsing is super simple only because we want to keep the -%% dependencies minimal. For now there can be one entry on the -%% command line: "debug-info" --spec parse_args([string()]) -> #data{}. -parse_args(Args0) -> - PossibleArgs = sets:from_list(["debug-info"]), - Args1 = sets:from_list(Args0), - Result = sets:subtract(Args1, PossibleArgs), - case sets:to_list(Result) of - [] -> - {ok, #data{debug_info = sets:is_element("debug-info", Args1)}}; - UnknownArgs -> - io:format("Unexpected command line arguments passed in: ~p~n", - [UnknownArgs]), - erlang:halt(120) - end. - - --spec bootstrap_configs(#data{}) -> ok. -bootstrap_configs(RequiredData)-> - io:format("Boostrapping app and rebar configurations~n"), - ok = if_single_app_project_update_app_src_version(RequiredData), - ok = if_compile_ports_add_pc_plugin(RequiredData), - ok = if_debug_info_add(RequiredData). - --spec bootstrap_plugins(#data{}) -> ok. -bootstrap_plugins(#data{plugins = Plugins}) -> - io:format("Bootstrapping rebar3 plugins~n"), - Target = "_build/default/plugins/", - Paths = string:tokens(Plugins, " "), - CopiableFiles = - lists:foldl(fun(Path, Acc) -> - gather_dependency(Path) ++ Acc - end, [], Paths), - lists:foreach(fun (Path) -> - ok = link_app(Path, Target) - end, CopiableFiles). - --spec bootstrap_libs(#data{}) -> ok. -bootstrap_libs(#data{erl_libs = ErlLibs}) -> - io:format("Bootstrapping dependent libraries~n"), - Target = "_build/default/lib/", - Paths = string:tokens(ErlLibs, ":"), - CopiableFiles = - lists:foldl(fun(Path, Acc) -> - gather_directory_contents(Path) ++ Acc - end, [], Paths), - lists:foreach(fun (Path) -> - ok = link_app(Path, Target) - end, CopiableFiles). - --spec gather_dependency(string()) -> [{string(), string()}]. -gather_dependency(Path) -> - FullLibrary = filename:join(Path, "lib/erlang/lib/"), - case filelib:is_dir(FullLibrary) of - true -> - gather_directory_contents(FullLibrary); - false -> - [raw_hex(Path)] - end. - --spec raw_hex(string()) -> {string(), string()}. -raw_hex(Path) -> - [_, Name] = re:split(Path, "-hex-source-"), - {Path, erlang:binary_to_list(Name)}. - --spec gather_directory_contents(string()) -> [{string(), string()}]. -gather_directory_contents(Path) -> - {ok, Names} = file:list_dir(Path), - lists:map(fun(AppName) -> - {filename:join(Path, AppName), fixup_app_name(AppName)} - end, Names). - -%% @doc -%% Makes a symlink from the directory pointed at by Path to a -%% directory of the same name in Target. So if we had a Path of -%% {`foo/bar/baz/bash`, `baz`} and a Target of `faz/foo/foos`, the symlink -%% would be `faz/foo/foos/baz`. --spec link_app({string(), string()}, string()) -> ok. -link_app({Path, TargetFile}, TargetDir) -> - Target = filename:join(TargetDir, TargetFile), - make_symlink(Path, Target). - --spec make_symlink(string(), string()) -> ok. -make_symlink(Path, TargetFile) -> - file:delete(TargetFile), - ok = filelib:ensure_dir(TargetFile), - io:format("Making symlink from ~s to ~s~n", [Path, TargetFile]), - ok = file:make_symlink(Path, TargetFile). - -%% @doc -%% This takes an app name in the standard OTP <name>-<version> format -%% and returns just the app name. Why? Because rebar doesn't -%% respect OTP conventions in some cases. --spec fixup_app_name(string()) -> string(). -fixup_app_name(FileName) -> - case string:tokens(FileName, "-") of - [Name] -> Name; - [Name, _Version] -> Name; - [Name, _Version, _Tag] -> Name - end. - --spec gather_required_data_from_the_environment(#data{}) -> {ok, #data{}}. -gather_required_data_from_the_environment(ArgData) -> - {ok, ArgData#data{ version = guard_env("version") - , erl_libs = get_env("ERL_LIBS", []) - , plugins = get_env("buildPlugins", []) - , root = code:root_dir() - , name = guard_env("name") - , compile_ports = nix2bool(get_env("compilePorts", ""))}}. - --spec nix2bool(any()) -> boolean(). -nix2bool("1") -> - true; -nix2bool("") -> - false. - -get_env(Name) -> - os:getenv(Name). -get_env(Name, Def) -> - case get_env(Name) of - false -> Def; - Val -> Val - end. - --spec guard_env(string()) -> string(). -guard_env(Name) -> - case get_env(Name) of - false -> - stderr("Expected Environment variable ~s! Are you sure you are " - "running in a Nix environment? Either a nix-build, " - "nix-shell, etc?~n", [Name]), - erlang:halt(1); - Variable -> - Variable - end. - -%% @doc -%% If debug info is set we need to add debug info to the list of compile options -%% --spec if_debug_info_add(#data{}) -> ok. -if_debug_info_add(#data{debug_info = true}) -> - ConfigTerms = add_debug_info(read_rebar_config()), - Text = lists:map(fun(Term) -> io_lib:format("~tp.~n", [Term]) end, - ConfigTerms), - file:write_file("rebar.config", Text); -if_debug_info_add(_) -> - ok. - --spec add_debug_info([term()]) -> [term()]. -add_debug_info(Config) -> - ExistingOpts = case lists:keysearch(erl_opts, 1, Config) of - {value, {erl_opts, ExistingOptsList}} -> ExistingOptsList; - _ -> [] - end, - case lists:member(debug_info, ExistingOpts) of - true -> - Config; - false -> - lists:keystore(erl_opts, 1, Config, - {erl_opts, [debug_info | ExistingOpts]}) - end. - - -%% @doc -%% If the compile ports flag is set, rewrite the rebar config to -%% include the 'pc' plugin. --spec if_compile_ports_add_pc_plugin(#data{}) -> ok. -if_compile_ports_add_pc_plugin(#data{compile_ports = true}) -> - ConfigTerms = add_pc_to_plugins(read_rebar_config()), - Text = lists:map(fun(Term) -> io_lib:format("~tp.~n", [Term]) end, - ConfigTerms), - file:write_file("rebar.config", Text); -if_compile_ports_add_pc_plugin(_) -> - ok. - --spec add_pc_to_plugins([term()]) -> [term()]. -add_pc_to_plugins(Config) -> - PluginList = case lists:keysearch(plugins, 1, Config) of - {value, {plugins, ExistingPluginList}} -> ExistingPluginList; - _ -> [] - end, - lists:keystore(plugins, 1, Config, {plugins, [pc | PluginList]}). - --spec read_rebar_config() -> [term()]. -read_rebar_config() -> - case file:consult("rebar.config") of - {ok, Terms} -> - Terms; - _ -> - stderr("Unable to read rebar config!", []), - erlang:halt(1) - end. - - --spec if_single_app_project_update_app_src_version(#data{}) -> ok. -if_single_app_project_update_app_src_version(#data{name = Name, - version = Version}) -> - SrcFile = filename:join("src", - lists:concat([Name, ".app.src"])), - - case filelib:is_file(SrcFile) of - true -> - update_app_src_with_version(SrcFile, Version); - false -> - ok - end. - --spec update_app_src_with_version(string(), string()) -> ok. -update_app_src_with_version(SrcFile, Version) -> - {ok, [{application, Name, Details}]} = file:consult(SrcFile), - NewDetails = lists:keyreplace(vsn, 1, Details, {vsn, Version}), - ok = file:write_file(SrcFile, io_lib:fwrite("~p.\n", [{application, Name, NewDetails}])). - -%% @doc -%% Write the result of the format string out to stderr. --spec stderr(string(), [term()]) -> ok. -stderr(FormatStr, Args) -> - io:put_chars(standard_error, io_lib:format(FormatStr, Args)). diff --git a/pkgs/development/tools/build-managers/rebar3/skip-plugins.patch b/pkgs/development/tools/build-managers/rebar3/skip-plugins.patch new file mode 100644 index 000000000000..3ee1656c9ede --- /dev/null +++ b/pkgs/development/tools/build-managers/rebar3/skip-plugins.patch @@ -0,0 +1,54 @@ +diff --git a/src/rebar_plugins.erl b/src/rebar_plugins.erl +index f2d22233..c61fa553 100644 +--- a/src/rebar_plugins.erl ++++ b/src/rebar_plugins.erl +@@ -106,31 +106,9 @@ handle_plugins(Profile, Plugins, State, Upgrade) -> + State3 = rebar_state:set(State2, deps_dir, DepsDir), + rebar_state:lock(State3, Locks). + +-handle_plugin(Profile, Plugin, State, Upgrade) -> ++handle_plugin(_Profile, Plugin, State, _Upgrade) -> + try +- {Apps, State2} = rebar_prv_install_deps:handle_deps_as_profile(Profile, State, [Plugin], Upgrade), +- {no_cycle, Sorted} = rebar_prv_install_deps:find_cycles(Apps), +- ToBuild = rebar_prv_install_deps:cull_compile(Sorted, []), +- +- %% Add already built plugin deps to the code path +- ToBuildPaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild], +- PreBuiltPaths = [Ebin || A <- Apps, +- Ebin <- [rebar_app_info:ebin_dir(A)], +- not lists:member(Ebin, ToBuildPaths)], +- code:add_pathsa(PreBuiltPaths), +- +- %% Build plugin and its deps +- build_plugins(ToBuild, Apps, State2), +- +- %% Add newly built deps and plugin to code path +- State3 = rebar_state:update_all_plugin_deps(State2, Apps), +- NewCodePaths = [rebar_app_info:ebin_dir(A) || A <- ToBuild], +- +- %% Store plugin code paths so we can remove them when compiling project apps +- State4 = rebar_state:update_code_paths(State3, all_plugin_deps, PreBuiltPaths++NewCodePaths), +- rebar_paths:set_paths([plugins], State4), +- +- {plugin_providers(Plugin), State4} ++ {plugin_providers(Plugin), State} + catch + ?WITH_STACKTRACE(C,T,S) + ?DEBUG("~p ~p ~p", [C, T, S]), +@@ -138,15 +116,6 @@ handle_plugin(Profile, Plugin, State, Upgrade) -> + {[], State} + end. + +-build_plugins(MustBuildApps, AllApps, State) -> +- State1 = rebar_state:deps_to_build(State, MustBuildApps), +- State2 = rebar_state:all_deps(State1, AllApps), +- State3 = rebar_state:set(State2, deps_dir, ?DEFAULT_PLUGINS_DIR), +- {Args, Extra} = rebar_state:command_parsed_args(State), +- State4 = rebar_state:command_parsed_args(State3, {[{deps_only, true}|Args], Extra}), +- rebar_prv_compile:do(State4), +- ok. +- + plugin_providers({Plugin, _, _, _}) when is_atom(Plugin) -> + validate_plugin(Plugin); + plugin_providers({Plugin, _, _}) when is_atom(Plugin) -> diff --git a/pkgs/development/tools/build-managers/sbt-extras/default.nix b/pkgs/development/tools/build-managers/sbt-extras/default.nix index b49e5f7558a9..76548e427d23 100644 --- a/pkgs/development/tools/build-managers/sbt-extras/default.nix +++ b/pkgs/development/tools/build-managers/sbt-extras/default.nix @@ -3,14 +3,14 @@ stdenv.mkDerivation rec { pname = "sbt-extras"; - rev = "a76f1f15e6ec39d886f8bf07d5bdfaf70cdc62d8"; - version = "2021-04-06"; + rev = "e5a5442acf36f047a75b397d7349e6fe6835ef24"; + version = "2021-04-26"; src = fetchFromGitHub { owner = "paulp"; repo = "sbt-extras"; inherit rev; - sha256 = "0zmhn8nvzrbw047g5z4q2slp0wdg6pvfh2pqnpwcq1hscf7dvz8f"; + sha256 = "0g7wyh0lhhdch7d6p118lwywy1lcdr1z631q891qhv624jnb1477"; }; dontBuild = true; diff --git a/pkgs/development/tools/build-managers/tup/default.nix b/pkgs/development/tools/build-managers/tup/default.nix index 85bf919f778f..403adaff89ed 100644 --- a/pkgs/development/tools/build-managers/tup/default.nix +++ b/pkgs/development/tools/build-managers/tup/default.nix @@ -4,37 +4,41 @@ let fuse = if stdenv.isDarwin then macfuse-stubs else fuse3; in stdenv.mkDerivation rec { pname = "tup"; - version = "0.7.10"; + version = "0.7.11"; outputs = [ "bin" "man" "out" ]; src = fetchFromGitHub { owner = "gittup"; repo = "tup"; rev = "v${version}"; - sha256 = "1qd07h4wi0743l7z2vybfvhwp61g2p2pc5qhl40672ryl24nvd1d"; + hash = "sha256-Q2Y5ErcfhLChi9Wezn8+7eNXYX2UXW1fBOqEclmgzOo="; }; nativeBuildInputs = [ pkg-config ]; buildInputs = [ fuse pcre ]; configurePhase = '' - sed -i 's/`git describe`/v${version}/g' src/tup/link.sh - sed -i 's/pcre-confg/pkg-config pcre/g' Tupfile Tuprules.tup + substituteInPlace src/tup/link.sh --replace '`git describe' '`echo ${version}' + substituteInPlace Tuprules.tup --replace 'pcre-config' 'pkg-config libpcre' ''; # Regular tup builds require fusermount to have suid, which nix cannot # currently provide in a build environment, so we bootstrap and use 'tup # generate' instead buildPhase = '' + runHook preBuild ./build.sh ./build/tup init ./build/tup generate script.sh ./script.sh + runHook postBuild ''; installPhase = '' + runHook preInstall install -D tup -t $bin/bin/ install -D tup.1 -t $man/share/man/man1/ + runHook postInstall ''; setupHook = ./setup-hook.sh; |
