tailscale: build derpprobe (#364918)
[NixPkgs.git] / pkgs / tools / backup / restic / default.nix
blob6192d0b37248f32cb8045b41e437a01ea3607b44
2   stdenv,
3   lib,
4   buildGoModule,
5   fetchFromGitHub,
6   installShellFiles,
7   makeWrapper,
8   nixosTests,
9   rclone,
10   python3,
13 buildGoModule rec {
14   pname = "restic";
15   version = "0.17.3";
17   src = fetchFromGitHub {
18     owner = "restic";
19     repo = "restic";
20     rev = "v${version}";
21     hash = "sha256-PTy/YcojJGrYQhdp98e3rEMqHIWDMR5jiSC6BdzBT/M=";
22   };
24   patches = [
25     # The TestRestoreWithPermissionFailure test fails in Nix’s build sandbox
26     ./0001-Skip-testing-restore-with-permission-failure.patch
27   ];
29   vendorHash = "sha256-tU2msDHktlU0SvvxLQCU64p8DpL8B0QiliVCuHlLTHQ=";
31   subPackages = [ "cmd/restic" ];
33   nativeBuildInputs = [
34     installShellFiles
35     makeWrapper
36   ];
38   nativeCheckInputs = [ python3 ];
40   passthru.tests = lib.optionalAttrs stdenv.hostPlatform.isLinux {
41     restic = nixosTests.restic;
42   };
44   postPatch = ''
45     rm cmd/restic/cmd_mount_integration_test.go
46   '';
48   postInstall =
49     ''
50       wrapProgram $out/bin/restic --prefix PATH : '${rclone}/bin'
51     ''
52     + lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
53       $out/bin/restic generate \
54         --bash-completion restic.bash \
55         --fish-completion restic.fish \
56         --zsh-completion restic.zsh \
57         --man .
58       installShellCompletion restic.{bash,fish,zsh}
59       installManPage *.1
60     '';
62   meta = with lib; {
63     homepage = "https://restic.net";
64     changelog = "https://github.com/restic/restic/blob/${src.rev}/CHANGELOG.md";
65     description = "Backup program that is fast, efficient and secure";
66     platforms = platforms.linux ++ platforms.darwin;
67     license = licenses.bsd2;
68     maintainers = [
69       maintainers.mbrgm
70       maintainers.dotlambda
71     ];
72     mainProgram = "restic";
73   };