Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 21 additions & 13 deletions pkgs/by-name/ra/radicle-node/package.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
asciidoctor,
fetchFromRadicle,
git,
gitMinimal,
installShellFiles,
jq,
lib,
makeWrapper,
makeBinaryWrapper,
man-db,
nixos,
nixosTests,
Expand All @@ -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 = ''
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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"
{
Expand All @@ -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
Expand Down Expand Up @@ -163,7 +170,8 @@ rustPlatform.buildRustPackage rec {
maintainers = with lib.maintainers; [
amesgen
lorenzleutgeb
defelo
];
mainProgram = "rad";
};
}
})
5 changes: 5 additions & 0 deletions pkgs/by-name/ra/radicle-node/update.sh
Original file line number Diff line number Diff line change
@@ -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
Loading