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