From 6896c88c1b6ae2b68d30e32b03d2c5c63b2d8a90 Mon Sep 17 00:00:00 2001 From: Enric Morales Date: Mon, 21 Oct 2024 08:28:41 +0000 Subject: [PATCH] lib25519: add update script Co-Authored-By: imad.nyc lib25519: 20240321 -> 20241004 lib25519: add version test script --- pkgs/by-name/li/lib25519/package.nix | 24 +++++++++++++++++++++--- pkgs/by-name/li/lib25519/update.sh | 10 ++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100755 pkgs/by-name/li/lib25519/update.sh diff --git a/pkgs/by-name/li/lib25519/package.nix b/pkgs/by-name/li/lib25519/package.nix index 68d35a796a03..515ef90967fa 100644 --- a/pkgs/by-name/li/lib25519/package.nix +++ b/pkgs/by-name/li/lib25519/package.nix @@ -3,16 +3,22 @@ lib, python3, fetchzip, + testers, + valgrind, librandombytes, libcpucycles, + lib25519, }: +let + version = "20241004"; +in stdenv.mkDerivation (finalAttrs: { pname = "lib25519"; - version = "20240321"; + inherit version; src = fetchzip { url = "https://lib25519.cr.yp.to/lib25519-${finalAttrs.version}.tar.gz"; - hash = "sha256-R10Q803vCjIZCS4Z/uErsx547RaXfAELGQm9NuNhw+I="; + hash = "sha256-gKLMk+yZ/nDlwohZiCFurSZwHExX3Ge2W1O0JoGQf8M="; }; patches = [ ./environment-variable-tools.patch ]; @@ -31,7 +37,10 @@ stdenv.mkDerivation (finalAttrs: { runHook postConfigure ''; - nativeBuildInputs = [ python3 ]; + nativeBuildInputs = [ + python3 + valgrind + ]; buildInputs = [ librandombytes libcpucycles @@ -52,6 +61,15 @@ stdenv.mkDerivation (finalAttrs: { runHook postInstallCheck ''; + passthru = { + updateScript = ./update.sh; + tests.version = testers.testVersion { + package = lib25519; + command = "lib25519-test | head -n 2 | grep version"; + version = "lib25519 version ${version}"; + }; + }; + meta = { homepage = "https://randombytes.cr.yp.to/"; description = "A simple API for applications generating fresh randomness"; diff --git a/pkgs/by-name/li/lib25519/update.sh b/pkgs/by-name/li/lib25519/update.sh new file mode 100755 index 000000000000..7d366810c762 --- /dev/null +++ b/pkgs/by-name/li/lib25519/update.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p curl cacert nix common-updater-scripts --pure +#shellcheck shell=bash + +set -eu -o pipefail + +# upstream doesn't use git, but has this file specifically for versioning +version="$(curl https://lib25519.cr.yp.to/lib25519-latest-version.txt)" + +update-source-version lib25519 "$version"