1{ lib
2, stdenv
3, fetchFromGitHub
4, makeWrapper
5, gnupg
6, perl
7}:
8
9let
10 perlEnv = perl.withPackages (p: with p; [ TextMarkdown ]);
11in
12stdenv.mkDerivation rec {
13 pname = "regpg";
14 version = "1.11";
15
16 src = fetchFromGitHub {
17 owner = "fanf2";
18 repo = "regpg";
19 rev = "regpg-${version}";
20 sha256 = "2ea99950804078190e1cc2a76d4740e3fdd5395a9043db3f3fe86bf2477d3a7d";
21 };
22
23 nativeBuildInputs = [ makeWrapper perlEnv ];
24
25 postPatch = ''
26 patchShebangs ./util/insert-here.pl ./util/markdown.pl
27 substituteInPlace ./Makefile \
28 --replace 'util/insert-here.pl' 'perl util/insert-here.pl'
29 substituteInPlace ./Makefile \
30 --replace 'util/markdown.pl' 'perl util/markdown.pl'
31 substituteInPlace util/insert-here.pl \
32 --replace 'qx(git describe)' '"regpg-${version}"'
33 '';
34
35 dontConfigure = true;
36
37 makeFlags = [ "prefix=$(out)" ];
38
39 postFixup = ''
40 patchShebangs $out/bin/regpg
41 wrapProgram $out/bin/regpg --prefix PATH ":" \
42 "${lib.makeBinPath [ gnupg ]}"
43 '';
44
45 meta = with lib; {
46 description = "GPG wrapper utility for storing secrets in VCS";
47 homepage = "https://dotat.at/prog/regpg";
48 license = licenses.gpl3;
49 platforms = platforms.all;
50 maintainers = with maintainers; [ _0xC45 ];
51 };
52}