1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 git,
6 makeWrapper,
7 openssl,
8 coreutils,
9 util-linux,
10 gnugrep,
11 gnused,
12 gawk,
13 testers,
14 transcrypt,
15}:
16
17stdenv.mkDerivation rec {
18 pname = "transcrypt";
19 version = "2.3.1";
20
21 src = fetchFromGitHub {
22 owner = "elasticdog";
23 repo = "transcrypt";
24 rev = "v${version}";
25 sha256 = "sha256-s95EnEmcdd5mFAKvtZ88aXxkrRLSZUP0VBrCy5PR4fo=";
26 };
27
28 nativeBuildInputs = [ makeWrapper ];
29 buildInputs = [
30 git
31 openssl
32 coreutils
33 util-linux
34 gnugrep
35 gnused
36 gawk
37 ];
38
39 installPhase = ''
40 install -m 755 -D transcrypt $out/bin/transcrypt
41 install -m 644 -D man/transcrypt.1 $out/share/man/man1/transcrypt.1
42 install -m 644 -D contrib/bash/transcrypt $out/share/bash-completion/completions/transcrypt
43 install -m 644 -D contrib/zsh/_transcrypt $out/share/zsh/site-functions/_transcrypt
44
45 wrapProgram $out/bin/transcrypt \
46 --prefix PATH : "${
47 lib.makeBinPath [
48 git
49 openssl
50 coreutils
51 util-linux
52 gnugrep
53 gnused
54 gawk
55 ]
56 }"
57
58 cat > $out/bin/transcrypt-depspathprefix << EOF
59 #!${stdenv.shell}
60 echo "${
61 lib.makeBinPath [
62 git
63 openssl
64 coreutils
65 gawk
66 ]
67 }:"
68 EOF
69 chmod +x $out/bin/transcrypt-depspathprefix
70 '';
71
72 passthru.tests.version = testers.testVersion {
73 package = transcrypt;
74 command = "transcrypt --version";
75 version = "transcrypt ${version}";
76 };
77
78 meta = with lib; {
79 description = "Transparently encrypt files within a Git repository";
80 longDescription = ''
81 A script to configure transparent encryption of sensitive files stored in
82 a Git repository. Files that you choose will be automatically encrypted
83 when you commit them, and automatically decrypted when you check them
84 out. The process will degrade gracefully, so even people without your
85 encryption password can safely commit changes to the repository's
86 non-encrypted files.
87 '';
88 homepage = "https://github.com/elasticdog/transcrypt";
89 license = licenses.mit;
90 maintainers = [ maintainers.elasticdog ];
91 platforms = platforms.all;
92 };
93}