50 lines
1.4 KiB
Nix
50 lines
1.4 KiB
Nix
{ stdenv, lib, buildGoModule, fetchFromGitHub, installShellFiles, makeWrapper
|
||
, nixosTests, rclone }:
|
||
|
||
buildGoModule rec {
|
||
pname = "restic";
|
||
version = "0.12.0";
|
||
|
||
src = fetchFromGitHub {
|
||
owner = "restic";
|
||
repo = "restic";
|
||
rev = "v${version}";
|
||
sha256 = "07gxf56g45gj2arvdnrr9656i9ykhy1y6k6zdlni1sa3aa2x2bbf";
|
||
};
|
||
|
||
patches = [
|
||
# The TestRestoreWithPermissionFailure test fails in Nix’s build sandbox
|
||
./0001-Skip-testing-restore-with-permission-failure.patch
|
||
];
|
||
|
||
vendorSha256 = "14z22lmdd681rn61alpqbn3i9fn0kcc74321vjvhz2ix2mch3c1z";
|
||
|
||
subPackages = [ "cmd/restic" ];
|
||
|
||
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
||
|
||
passthru.tests.restic = nixosTests.restic;
|
||
|
||
postPatch = ''
|
||
rm cmd/restic/integration_fuse_test.go
|
||
'';
|
||
|
||
postInstall = ''
|
||
wrapProgram $out/bin/restic --prefix PATH : '${rclone}/bin'
|
||
'' + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
|
||
$out/bin/restic generate \
|
||
--bash-completion restic.bash \
|
||
--zsh-completion restic.zsh \
|
||
--man .
|
||
installShellCompletion restic.{bash,zsh}
|
||
installManPage *.1
|
||
'';
|
||
|
||
meta = with lib; {
|
||
homepage = "https://restic.net";
|
||
description = "A backup program that is fast, efficient and secure";
|
||
platforms = platforms.linux ++ platforms.darwin;
|
||
license = licenses.bsd2;
|
||
maintainers = [ maintainers.mbrgm ];
|
||
};
|
||
}
|