about summary refs log tree commit diff
path: root/pkgs/tools/backup/restic
diff options
context:
space:
mode:
authorBerk D. Demir <bdd@mindcast.org>2022-05-13 00:36:32 -0700
committerBerk D. Demir <bdd@mindcast.org>2022-05-13 09:06:03 -0700
commitfdb1595ffb41c8c696edd3a7468071649c2fe6bf (patch)
tree721bd7a51d95b49fd25302efd991535eadd7b8b5 /pkgs/tools/backup/restic
parent518cffd23db9d5e46ec0f4932e75a8b621bf248b (diff)
restic-rest-server: Fix tests on Darwin
Backport unit test changes from project's master branch to replace
hardcoded /tmp with os.TempDir() calls in Go.

It can now handle /private/tmp/nix-build-{pname}-{version}.drv-0 paths
on Darwin.
Diffstat (limited to 'pkgs/tools/backup/restic')
-rw-r--r--pkgs/tools/backup/restic/rest-server.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/pkgs/tools/backup/restic/rest-server.nix b/pkgs/tools/backup/restic/rest-server.nix
index 699343b8728d2..6296103c1c28a 100644
--- a/pkgs/tools/backup/restic/rest-server.nix
+++ b/pkgs/tools/backup/restic/rest-server.nix
@@ -1,22 +1,27 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, fetchpatch }:
 
 buildGoModule rec {
   pname = "restic-rest-server";
   version = "0.11.0";
+  owner = "restic";
+  repo = "rest-server";
 
   src = fetchFromGitHub {
-    owner = "restic";
-    repo = "rest-server";
+    inherit owner repo;
     rev = "v${version}";
     hash = "sha256-ninPODztNzvB2js9cuNAuExQLK/OGOu80ZNW0BPrdds=";
   };
 
   vendorSha256 = "sha256-8x5qYvIX/C5BaewrTNVbIIadL+7XegbRUZiEDWmJM+c=";
 
-  preCheck = ''
-    substituteInPlace cmd/rest-server/main_test.go \
-      --replace "/tmp/restic" "/build/restic"
-  '';
+  patches = [
+    (fetchpatch {
+      name = "backport_rest-server_tests_os.TempDir.patch";
+      url = "https://github.com/${owner}/${repo}/commit/a87a50ad114bdaddc895413396438df6ea0affbb.patch";
+      sha256 = "sha256-O6ENxTK2fCVTZZKTFHrvZ+3dT8TbgbIE0o3sYE/RUqc=";
+    })
+
+  ];
 
   meta = with lib; {
     inherit (src.meta) homepage;