From 08e220283a9930e861675546043aa3865aa375d8 Mon Sep 17 00:00:00 2001 From: Tom van Dijk <18gatenmaker6@gmail.com> Date: Thu, 3 Jul 2025 21:40:17 +0200 Subject: [PATCH] restic: add openssh to PATH, refactor --- pkgs/by-name/re/restic/package.nix | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/pkgs/by-name/re/restic/package.nix b/pkgs/by-name/re/restic/package.nix index 795389d734b2..8cca32806880 100644 --- a/pkgs/by-name/re/restic/package.nix +++ b/pkgs/by-name/re/restic/package.nix @@ -4,8 +4,10 @@ buildGoModule, fetchFromGitHub, installShellFiles, - makeWrapper, + makeBinaryWrapper, + versionCheckHook, nixosTests, + openssh, rclone, python3, }: @@ -32,11 +34,15 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles - makeWrapper + makeBinaryWrapper ]; nativeCheckInputs = [ python3 ]; + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "version"; + passthru.tests = lib.optionalAttrs stdenv.hostPlatform.isLinux { restic = nixosTests.restic; }; @@ -46,7 +52,13 @@ buildGoModule rec { ''; postInstall = '' - wrapProgram $out/bin/restic --prefix PATH : '${rclone}/bin' + wrapProgram $out/bin/restic \ + --prefix PATH : "${ + lib.makeBinPath [ + openssh + rclone + ] + }" '' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) '' $out/bin/restic generate \ @@ -58,13 +70,13 @@ buildGoModule rec { installManPage *.1 ''; - meta = with lib; { + meta = { homepage = "https://restic.net"; changelog = "https://github.com/restic/restic/blob/${src.rev}/CHANGELOG.md"; description = "Backup program that is fast, efficient and secure"; - platforms = platforms.linux ++ platforms.darwin; - license = licenses.bsd2; - maintainers = with maintainers; [ + platforms = with lib.platforms; linux ++ darwin; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ mbrgm dotlambda ryan4yin