git.iko.soy/typeable/nixpkgs
on master help sign in
rebar3: add updateScript
34ea3cdDavid
pkgs/development/tools/build-managers/rebar3/default.nix+28−2
@@ -1,10 +1,11 @@
1{ lib, stdenv, fetchFromGitHub,
1{ lib, stdenv, fetchFromGitHub,
2− fetchHex, erlang, makeWrapper }:
2+ fetchHex, erlang, makeWrapper,
3+ writeScript, common-updater-scripts, coreutils, git, gnused, nix, rebar3-nix }:
3
4
4let
5let
5 version = "3.15.1";
6 version = "3.15.1";
6 owner = "erlang";
7 owner = "erlang";
7− deps = import ./rebar-deps.nix { inherit fetchHex; };
8+ deps = import ./rebar-deps.nix { inherit fetchFromGitHub fetchHex; };
8 rebar3 = stdenv.mkDerivation rec {
9 rebar3 = stdenv.mkDerivation rec {
9 pname = "rebar3";
10 pname = "rebar3";
10 inherit version erlang;
11 inherit version erlang;
@@ -63,6 +64,31 @@ let
63 license = lib.licenses.asl20;
64 license = lib.licenses.asl20;
64 };
65 };
65
66
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+ '';
66 };
92 };
67 rebar3WithPlugins = { plugins ? [ ], globalPlugins ? [ ] }:
93 rebar3WithPlugins = { plugins ? [ ], globalPlugins ? [ ] }:
68 let
94 let
pkgs/development/tools/build-managers/rebar3/rebar-deps.nix+2−1
@@ -1,4 +1,5 @@
1+# Generated by rebar3_nix
1−{ fetchHex }:
2+{ fetchHex, fetchFromGitHub }:
2{
3{
3 ssl_verify_fun = fetchHex {
4 ssl_verify_fun = fetchHex {
4 pkg = "ssl_verify_fun";
5 pkg = "ssl_verify_fun";