radicle-node: use canonical release reference, add updateScript, modernize, adopt (#435071)

This commit is contained in:
Felix Bargfeldt
2025-08-23 00:00:21 +02:00
committed by GitHub
2 changed files with 25 additions and 13 deletions
+20 -13
View File
@@ -1,11 +1,11 @@
{
asciidoctor,
fetchFromRadicle,
git,
gitMinimal,
installShellFiles,
jq,
lib,
makeWrapper,
makeBinaryWrapper,
man-db,
nixos,
nixosTests,
@@ -16,17 +16,17 @@
stdenv,
testers,
xdg-utils,
versionCheckHook,
}:
rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
pname = "radicle-node";
version = "1.3.0";
env.RADICLE_VERSION = version;
src = fetchFromRadicle {
seed = "seed.radicle.xyz";
repo = "z3gqcJUoA1n9HaHKufZs5FCSGazv5";
node = "z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM";
tag = "v${version}";
tag = "releases/${finalAttrs.version}";
hash = "sha256-0gK+fM/YGGpxlcR1HQixbLK0/sv+HH29h6ajEP2w2pI=";
leaveDotGit = true;
postFetch = ''
@@ -38,12 +38,14 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-qLRFZXbVbsgMyXiljsb8lOBCDZKa17LcxWuPaUYSG70=";
env.RADICLE_VERSION = finalAttrs.version;
nativeBuildInputs = [
asciidoctor
installShellFiles
makeWrapper
makeBinaryWrapper
];
nativeCheckInputs = [ git ];
nativeCheckInputs = [ gitMinimal ];
preBuild = ''
export GIT_HEAD=$(<$src/.git_head)
@@ -56,7 +58,7 @@ rustPlatform.buildRustPackage rec {
"--package=radicle-remote-helper"
];
cargoTestFlags = cargoBuildFlags;
cargoTestFlags = finalAttrs.cargoBuildFlags;
# tests regularly time out on aarch64
doCheck = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86;
@@ -83,13 +85,17 @@ rustPlatform.buildRustPackage rec {
done
'';
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
doInstallCheck = true;
postFixup = ''
for program in $out/bin/* ;
do
wrapProgram "$program" \
--prefix PATH : "${
lib.makeBinPath [
git
gitMinimal
man-db
openssh
xdg-utils
@@ -98,12 +104,12 @@ rustPlatform.buildRustPackage rec {
done
'';
passthru.updateScript = ./update.sh;
passthru.tests =
let
package = radicle-node;
in
{
version = testers.testVersion { inherit package; };
basic =
runCommand "${package.name}-basic-test"
{
@@ -124,7 +130,7 @@ rustPlatform.buildRustPackage rec {
rad debug | jq -e '
(.sshVersion | contains("${openssh.version}"))
and
(.gitVersion | contains("${git.version}"))
(.gitVersion | contains("${gitMinimal.version}"))
'
touch $out
@@ -163,7 +169,8 @@ rustPlatform.buildRustPackage rec {
maintainers = with lib.maintainers; [
amesgen
lorenzleutgeb
defelo
];
mainProgram = "rad";
};
}
})
+5
View File
@@ -0,0 +1,5 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils gnused common-updater-scripts nix-update
version=$(list-git-tags | tail -1 | sed 's|^releases/||')
nix-update --version="$version" radicle-node