Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
87 lines
1.9 KiB
Nix
87 lines
1.9 KiB
Nix
{
|
||
stdenv,
|
||
lib,
|
||
buildGoModule,
|
||
fetchFromGitHub,
|
||
installShellFiles,
|
||
makeBinaryWrapper,
|
||
versionCheckHook,
|
||
nixosTests,
|
||
openssh,
|
||
rclone,
|
||
python3,
|
||
}:
|
||
|
||
buildGoModule rec {
|
||
pname = "restic";
|
||
version = "0.18.1";
|
||
|
||
src = fetchFromGitHub {
|
||
owner = "restic";
|
||
repo = "restic";
|
||
rev = "v${version}";
|
||
hash = "sha256-lLinqZUOsZCPPybvVDB1f8o9Hl5qKYi0eHwJAaydsD8=";
|
||
};
|
||
|
||
patches = [
|
||
# The TestRestoreWithPermissionFailure test fails in Nix’s build sandbox
|
||
./0001-Skip-testing-restore-with-permission-failure.patch
|
||
];
|
||
|
||
vendorHash = "sha256-4GVhG1sjFiuKyDUAgmSmFww5bDKIoCjejkkoSqkvU4E=";
|
||
|
||
subPackages = [ "cmd/restic" ];
|
||
|
||
nativeBuildInputs = [
|
||
installShellFiles
|
||
makeBinaryWrapper
|
||
];
|
||
|
||
nativeCheckInputs = [ python3 ];
|
||
|
||
doInstallCheck = true;
|
||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||
versionCheckProgramArg = "version";
|
||
|
||
passthru.tests = lib.optionalAttrs stdenv.hostPlatform.isLinux {
|
||
restic = nixosTests.restic;
|
||
};
|
||
|
||
postPatch = ''
|
||
rm cmd/restic/cmd_mount_integration_test.go
|
||
'';
|
||
|
||
postInstall = ''
|
||
wrapProgram $out/bin/restic \
|
||
--prefix PATH : "${
|
||
lib.makeBinPath [
|
||
openssh
|
||
rclone
|
||
]
|
||
}"
|
||
''
|
||
+ lib.optionalString (stdenv.hostPlatform == stdenv.buildPlatform) ''
|
||
$out/bin/restic generate \
|
||
--bash-completion restic.bash \
|
||
--fish-completion restic.fish \
|
||
--zsh-completion restic.zsh \
|
||
--man .
|
||
installShellCompletion restic.{bash,fish,zsh}
|
||
installManPage *.1
|
||
'';
|
||
|
||
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 = with lib.platforms; linux ++ darwin;
|
||
license = lib.licenses.bsd2;
|
||
maintainers = with lib.maintainers; [
|
||
mbrgm
|
||
dotlambda
|
||
ryan4yin
|
||
];
|
||
mainProgram = "restic";
|
||
};
|
||
}
|