git.iko.soy/typeable/nixpkgs
on master help sign in
rebar3: add updateScript
commit34ea3cd906ae88e36561aa83f28bf9600745cbdb authorDavid <dlesl@users.noreply.github.com> dateTue 11 May 2021, 18:08 (6 years ago) parentf2dd3ea
2 files changed+30−3
pkgs/development/tools/build-managers/rebar3/default.nix+28−2 pkgs/development/tools/build-managers/rebar3/rebar-deps.nix+2−1
pkgs/development/tools/build-managers/rebar3/default.nix+28−2
@@ -1,10 +1,11 @@
11{ lib, stdenv, fetchFromGitHub,
2− fetchHex, erlang, makeWrapper }:
2+ fetchHex, erlang, makeWrapper,
3+ writeScript, common-updater-scripts, coreutils, git, gnused, nix, rebar3-nix }:
34
45let
56 version = "3.15.1";
67 owner = "erlang";
7− deps = import ./rebar-deps.nix { inherit fetchHex; };
8+ deps = import ./rebar-deps.nix { inherit fetchFromGitHub fetchHex; };
89 rebar3 = stdenv.mkDerivation rec {
910 pname = "rebar3";
1011 inherit version erlang;
@@ -63,6 +64,31 @@ let
6364 license = lib.licenses.asl20;
6465 };
6566
67+ passthru.updateScript = writeScript "update.sh" ''
68+ #!${stdenv.shell}
69+ set -ox errexit
70+ PATH=${
71+ lib.makeBinPath [
72+ common-updater-scripts
73+ coreutils
74+ git
75+ gnused
76+ nix
77+ (rebar3WithPlugins { globalPlugins = [rebar3-nix]; })
78+ ]
79+ }
80+ latest=$(list-git-tags https://github.com/${owner}/${pname}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1)
81+ if [ "$latest" != "${version}" ]; then
82+ nixpkgs="$(git rev-parse --show-toplevel)"
83+ nix_path="$nixpkgs/pkgs/development/tools/build-managers/rebar3"
84+ update-source-version rebar3 "$latest" --version-key=version --print-changes --file="$nix_path/default.nix"
85+ tmpdir=$(mktemp -d)
86+ cp -R $(nix-build $nixpkgs --no-out-link -A rebar3.src)/* "$tmpdir"
87+ (cd "$tmpdir" && rebar3 nix lock -o "$nix_path/rebar-deps.nix")
88+ else
89+ echo "rebar3 is already up-to-date"
90+ fi
91+ '';
6692 };
6793 rebar3WithPlugins = { plugins ? [ ], globalPlugins ? [ ] }:
6894 let
pkgs/development/tools/build-managers/rebar3/rebar-deps.nix+2−1
@@ -1,4 +1,5 @@
1−{ fetchHex }:
1+# Generated by rebar3_nix
2+{ fetchHex, fetchFromGitHub }:
23{
34 ssl_verify_fun = fetchHex {
45 pkg = "ssl_verify_fun";