1{ lib
2, stdenv
3, fetchFromGitHub
4, expect
5, which
6, gnupg
7, coreutils
8, git
9, pinentry
10, gnutar
11, procps
12}:
13
14stdenv.mkDerivation rec {
15 pname = "blackbox";
16 version = "2.0.0";
17
18 src = fetchFromGitHub {
19 owner = "stackexchange";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "1plwdmzds6dq2rlp84dgiashrfg0kg4yijhnxaapz2q4d1vvx8lq";
23 };
24
25 buildInputs = [ gnupg ];
26
27 # https://github.com/NixOS/nixpkgs/issues/134445
28 doCheck = !stdenv.isDarwin && stdenv.isx86_64;
29
30 nativeCheckInputs = [
31 expect
32 which
33 coreutils
34 pinentry.tty
35 git
36 gnutar
37 procps
38 ];
39
40 postPatch = ''
41 patchShebangs bin tools
42 substituteInPlace Makefile \
43 --replace "PREFIX?=/usr/local" "PREFIX=$out"
44
45 substituteInPlace tools/confidence_test.sh \
46 --replace 'PATH="''${blackbox_home}:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/local/bin:/usr/pkg/bin:/usr/pkg/gnu/bin:''${blackbox_home}"' \
47 "PATH=/build/source/bin/:$PATH"
48 '';
49
50 installPhase = ''
51 runHook preInstall
52 mkdir -p $out/bin
53 make copy-install
54 runHook postInstall
55 '';
56
57 meta = with lib; {
58 description = "Safely store secrets in a VCS repo";
59 maintainers = with maintainers; [ ericsagnes ];
60 license = licenses.mit;
61 platforms = platforms.all;
62 };
63}