rebar3: add updateScript
This commit is contained in:
parent
f2dd3eac0e
commit
34ea3cd906
@ -1,10 +1,11 @@
|
|||||||
{ lib, stdenv, fetchFromGitHub,
|
{ lib, stdenv, fetchFromGitHub,
|
||||||
fetchHex, erlang, makeWrapper }:
|
fetchHex, erlang, makeWrapper,
|
||||||
|
writeScript, common-updater-scripts, coreutils, git, gnused, nix, rebar3-nix }:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = "3.15.1";
|
version = "3.15.1";
|
||||||
owner = "erlang";
|
owner = "erlang";
|
||||||
deps = import ./rebar-deps.nix { inherit fetchHex; };
|
deps = import ./rebar-deps.nix { inherit fetchFromGitHub fetchHex; };
|
||||||
rebar3 = stdenv.mkDerivation rec {
|
rebar3 = stdenv.mkDerivation rec {
|
||||||
pname = "rebar3";
|
pname = "rebar3";
|
||||||
inherit version erlang;
|
inherit version erlang;
|
||||||
@ -63,6 +64,31 @@ let
|
|||||||
license = lib.licenses.asl20;
|
license = lib.licenses.asl20;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 ? [ ] }:
|
rebar3WithPlugins = { plugins ? [ ], globalPlugins ? [ ] }:
|
||||||
let
|
let
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ fetchHex }:
|
# Generated by rebar3_nix
|
||||||
|
{ fetchHex, fetchFromGitHub }:
|
||||||
{
|
{
|
||||||
ssl_verify_fun = fetchHex {
|
ssl_verify_fun = fetchHex {
|
||||||
pkg = "ssl_verify_fun";
|
pkg = "ssl_verify_fun";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user