diff --git a/pkgs/by-name/ra/radicle-node/package.nix b/pkgs/by-name/ra/radicle-node/package.nix index 347044035a06d..526396400d2c5 100644 --- a/pkgs/by-name/ra/radicle-node/package.nix +++ b/pkgs/by-name/ra/radicle-node/package.nix @@ -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,18 @@ rustPlatform.buildRustPackage rec { done ''; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/rad"; + 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 +105,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 +131,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 +170,8 @@ rustPlatform.buildRustPackage rec { maintainers = with lib.maintainers; [ amesgen lorenzleutgeb + defelo ]; mainProgram = "rad"; }; -} +}) diff --git a/pkgs/by-name/ra/radicle-node/update.sh b/pkgs/by-name/ra/radicle-node/update.sh new file mode 100755 index 0000000000000..b1a79b18da559 --- /dev/null +++ b/pkgs/by-name/ra/radicle-node/update.sh @@ -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