about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/asc-key-to-qr-code-gif/default.nix
blob: 19c9acc0a457752d54006413063a97c90ddb7c67 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ stdenv, fetchFromGitHub, imagemagick, qrencode
, testQR ? false, zbar ? null
}:

assert testQR -> zbar != false;

stdenv.mkDerivation rec {
  pname = "asc-key-to-qr-code-gif";
  version = "20180613";

  src = fetchFromGitHub {
    owner = "yishilin14";
    repo = "asc-key-to-qr-code-gif";
    rev = "5b7b239a0089a5269444cbe8a651c99dd43dce3f";
    sha256 = "0yrc302a2fhbzryb10718ky4fymfcps3lk67ivis1qab5kbp6z8r";
  };

  buildInputs = [ imagemagick qrencode ] ++ stdenv.lib.optional testQR zbar;
  dontBuild = true;
  dontStrip = true;
  dontPatchELF = true;

  preInstall = ''
    substituteInPlace asc-to-gif.sh \
      --replace "convert" "${imagemagick}/bin/convert" \
      --replace "qrencode" "${qrencode.bin}/bin/qrencode"
  '';

  installPhase = ''
    mkdir -p $out/bin
    cp * $out/bin/
  '';

  meta = with stdenv.lib; {
    homepage = https://github.com/yishilin14/asc-key-to-qr-code-gif;
    description = "Convert ASCII-armored PGP keys to animated QR code";
    platforms = platforms.linux;
    maintainers = with maintainers; [ asymmetric ];
  };
}