diff --git a/pkgs/by-name/re/reposilite/package.nix b/pkgs/by-name/re/reposilite/package.nix index 1a8a443a3598..c982a7aac043 100644 --- a/pkgs/by-name/re/reposilite/package.nix +++ b/pkgs/by-name/re/reposilite/package.nix @@ -41,6 +41,8 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstall ''; + passthru.updateScript = ./update.sh; + meta = { description = "Lightweight and easy-to-use repository management software dedicated for the Maven based artifacts in the JVM ecosystem"; homepage = "https://github.com/dzikoysk/reposilite"; diff --git a/pkgs/by-name/re/reposilite/plugins.json b/pkgs/by-name/re/reposilite/plugins.json new file mode 100644 index 000000000000..6cbf15625a2e --- /dev/null +++ b/pkgs/by-name/re/reposilite/plugins.json @@ -0,0 +1,7 @@ +{ + "checksum": "sha256-s7GADQqFsoEDM2vtJFE/C/F5jGyQeYlT3BntvHS4DtQ=", + "groovy": "sha256-8HWMqZZNIqCBpkMuCjKxqTLcQ2dYaOAAYON9QrXYEyo=", + "migration": "sha256-Xv0+RsXZzyGV/4v0IT3hfNANiC1OWVYFoTZHDxduKh0=", + "prometheus": "sha256-F5fSUo6wt7L3R/xCike0SlfG3CyxHKrlrg+SNrUYtm4=", + "swagger": "sha256-wyXKrYBhigHVtxq/RZiJhnigc3Z/UCbYotrF6VLLTGA=" +} diff --git a/pkgs/by-name/re/reposilite/plugins.nix b/pkgs/by-name/re/reposilite/plugins.nix index 8b5881181553..68a0ea2cfffb 100644 --- a/pkgs/by-name/re/reposilite/plugins.nix +++ b/pkgs/by-name/re/reposilite/plugins.nix @@ -1,7 +1,11 @@ { + lib, generateSplicesForMkScope, makeScopeWithSplicing', }: +let + pluginHashes = lib.importJSON ./plugins.json; +in makeScopeWithSplicing' { otherSplices = generateSplicesForMkScope "reposilitePlugins"; f = @@ -39,11 +43,5 @@ makeScopeWithSplicing' { ) ) { }; } - // builtins.mapAttrs (name: hash: self.fetchPlugin { inherit name hash; }) { - checksum = "sha256-s7GADQqFsoEDM2vtJFE/C/F5jGyQeYlT3BntvHS4DtQ="; - groovy = "sha256-8HWMqZZNIqCBpkMuCjKxqTLcQ2dYaOAAYON9QrXYEyo="; - migration = "sha256-Xv0+RsXZzyGV/4v0IT3hfNANiC1OWVYFoTZHDxduKh0="; - prometheus = "sha256-F5fSUo6wt7L3R/xCike0SlfG3CyxHKrlrg+SNrUYtm4="; - swagger = "sha256-wyXKrYBhigHVtxq/RZiJhnigc3Z/UCbYotrF6VLLTGA="; - }; + // builtins.mapAttrs (name: hash: self.fetchPlugin { inherit name hash; }) pluginHashes; } diff --git a/pkgs/by-name/re/reposilite/update.sh b/pkgs/by-name/re/reposilite/update.sh new file mode 100755 index 000000000000..806a75716771 --- /dev/null +++ b/pkgs/by-name/re/reposilite/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl jq common-updater-scripts + +# shellcheck shell=bash + +set -euo pipefail + +latestVersion=$(list-git-tags --url=https://github.com/dzikoysk/reposilite | grep -E '^[0-9.]+$' | sort --reverse --version-sort | head -n 1) + +update-source-version reposilite "$latestVersion" + +jq -r 'keys[]' ./pkgs/by-name/re/reposilite/plugins.json | while read -r plugin; do + tmpfile=$(mktemp) + curl -o "$tmpfile" "https://maven.reposilite.com/releases/com/reposilite/plugin/$plugin-plugin/$latestVersion/$plugin-plugin-$latestVersion-all.jar" + hash=$(nix-hash --sri --flat --type sha256 "$tmpfile") + + updatedContent=$(jq ".$plugin = \"$hash\"" ./pkgs/by-name/re/reposilite/plugins.json) + echo -E "$updatedContent" > ./pkgs/by-name/re/reposilite/plugins.json +done +