erlang-ls: add updateScript

To ensure dependencies are also updated
This commit is contained in:
David 2021-08-15 22:48:27 +02:00 committed by Raphael Megzari
parent 4082c9b89b
commit 4d322f3e58
2 changed files with 22 additions and 3 deletions

View file

@ -1,10 +1,11 @@
{ fetchFromGitHub, fetchHex, rebar3Relx, buildRebar3, rebar3-proper, stdenv, lib }:
{ fetchFromGitHub, fetchgit, fetchHex, rebar3Relx, buildRebar3, rebar3-proper
, stdenv, writeScript, lib }:
let
version = "0.18.0";
owner = "erlang-ls";
repo = "erlang_ls";
deps = import ./rebar-deps.nix {
inherit fetchHex fetchFromGitHub;
inherit fetchHex fetchFromGitHub fetchgit;
builder = buildRebar3;
overrides = (self: super: {
proper = super.proper.overrideAttrs (_: {
@ -45,4 +46,22 @@ rebar3Relx {
platforms = platforms.unix;
license = licenses.asl20;
};
passthru.updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p common-updater-scripts coreutils git gnused gnutar gzip "rebar3WithPlugins { globalPlugins = [ beamPackages.rebar3-nix ]; }"
set -ox errexit
latest=$(list-git-tags https://github.com/${owner}/${repo}.git | sed -n '/[\d\.]\+/p' | sort -V | tail -1)
if [[ "$latest" != "${version}" ]]; then
nixpkgs="$(git rev-parse --show-toplevel)"
nix_path="$nixpkgs/pkgs/development/beam-modules/erlang-ls"
update-source-version erlang-ls "$latest" --version-key=version --print-changes --file="$nix_path/default.nix"
tmpdir=$(mktemp -d)
cp -R $(nix-build $nixpkgs --no-out-link -A erlang-ls.src)/* "$tmpdir"
DEBUG=1
(cd "$tmpdir" && HOME=. rebar3 as test nix lock -o "$nix_path/rebar-deps.nix")
else
echo "erlang-ls is already up-to-date"
fi
'';
}

View file

@ -1,6 +1,6 @@
# Generated by rebar3_nix
let fetchOnly = { src, ... }: src;
in { builder ? fetchOnly, fetchHex, fetchFromGitHub, overrides ? (x: y: { }) }:
in { builder ? fetchOnly, fetchHex, fetchgit, fetchFromGitHub, overrides ? (x: y: { }) }:
let
self = packages // (overrides self packages);
packages = with self; {