1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, installShellFiles
6, Foundation
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "rage";
11 version = "0.9.0";
12
13 src = fetchFromGitHub {
14 owner = "str4d";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "sha256-/qrhD7AqVGMBi6PyvYww5PxukUU//KrttKqnPS0OYPc=";
18 };
19
20 cargoSha256 = "sha256-hVjtjeaIyySAHm3v0kFQ387THqYU1s+nGdBUwzIzBjg=";
21
22 nativeBuildInputs = [
23 installShellFiles
24 ];
25
26 buildInputs = lib.optionals stdenv.isDarwin [
27 Foundation
28 ];
29
30 # cargo test has an x86-only dependency
31 doCheck = stdenv.hostPlatform.isx86;
32
33 postBuild = ''
34 cargo run --example generate-docs
35 cargo run --example generate-completions
36 '';
37
38 postInstall = ''
39 installManPage target/manpages/*
40 installShellCompletion target/completions/*.{bash,fish,zsh}
41 '';
42
43 meta = with lib; {
44 description = "A simple, secure and modern encryption tool with small explicit keys, no config options, and UNIX-style composability";
45 homepage = "https://github.com/str4d/rage";
46 changelog = "https://github.com/str4d/rage/raw/v${version}/rage/CHANGELOG.md";
47 license = with licenses; [ asl20 mit ]; # either at your option
48 maintainers = with maintainers; [ marsam ryantm ];
49 };
50}