1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rustPlatform,
6 installShellFiles,
7 nix-update-script,
8}:
9
10rustPlatform.buildRustPackage rec {
11 pname = "rustic";
12 version = "0.9.5";
13
14 src = fetchFromGitHub {
15 owner = "rustic-rs";
16 repo = "rustic";
17 tag = "v${version}";
18 hash = "sha256-HYPzgynCeWDRRNyACHqnzkjn6uZWS0TDHuJE9STJxbQ=";
19 };
20
21 cargoHash = "sha256-+BlLVnvI2qBfwEtyxmZFNhR9MEzs0/a1Ce6ALOKtoPU=";
22
23 nativeBuildInputs = [ installShellFiles ];
24
25 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
26 installShellCompletion --cmd rustic \
27 --bash <($out/bin/rustic completions bash) \
28 --fish <($out/bin/rustic completions fish) \
29 --zsh <($out/bin/rustic completions zsh)
30 '';
31
32 passthru.updateScript = nix-update-script { };
33
34 meta = {
35 homepage = "https://github.com/rustic-rs/rustic";
36 changelog = "https://github.com/rustic-rs/rustic/blob/${src.rev}/CHANGELOG.md";
37 description = "Fast, encrypted, deduplicated backups powered by pure Rust";
38 mainProgram = "rustic";
39 platforms = lib.platforms.linux ++ lib.platforms.darwin;
40 license = [
41 lib.licenses.mit
42 lib.licenses.asl20
43 ];
44 maintainers = [
45 lib.maintainers.nobbz
46 lib.maintainers.pmw
47 ];
48 };
49}