reposilite: add updateScript

this script also updates the plugin hashes

(cherry picked from commit e69c6d0fdc)
This commit is contained in:
uku
2025-03-19 11:33:37 +01:00
committed by github-actions[bot]
parent 1751c9cb80
commit 5625c888a5
4 changed files with 34 additions and 7 deletions

View File

@@ -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";

View File

@@ -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="
}

View File

@@ -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;
}

View File

@@ -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