2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, imagemagick, qrencode
|
2018-06-12 18:54:44 +02:00
|
|
|
, testQR ? false, zbar ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert testQR -> zbar != false;
|
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "asc-key-to-qr-code-gif";
|
2018-06-12 18:54:44 +02:00
|
|
|
version = "20180613";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "yishilin14";
|
|
|
|
repo = "asc-key-to-qr-code-gif";
|
|
|
|
rev = "5b7b239a0089a5269444cbe8a651c99dd43dce3f";
|
|
|
|
sha256 = "0yrc302a2fhbzryb10718ky4fymfcps3lk67ivis1qab5kbp6z8r";
|
|
|
|
};
|
|
|
|
|
|
|
|
dontBuild = true;
|
|
|
|
dontStrip = true;
|
|
|
|
dontPatchELF = true;
|
|
|
|
|
2019-06-23 13:39:01 +02:00
|
|
|
preInstall = let
|
|
|
|
substitutions = [
|
|
|
|
''--replace "convert" "${imagemagick}/bin/convert"''
|
|
|
|
''--replace "qrencode" "${qrencode.bin}/bin/qrencode"''
|
2021-01-15 10:19:50 +01:00
|
|
|
] ++ lib.optional testQR [
|
2019-06-23 13:39:01 +02:00
|
|
|
''--replace "hash zbarimg" "true"'' # hash does not work on NixOS
|
|
|
|
''--replace "$(zbarimg --raw" "$(${zbar.out}/bin/zbarimg --raw"''
|
|
|
|
];
|
|
|
|
in ''
|
2021-01-15 10:19:50 +01:00
|
|
|
substituteInPlace asc-to-gif.sh ${lib.concatStringsSep " " substitutions}
|
2018-06-12 18:54:44 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp * $out/bin/
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/yishilin14/asc-key-to-qr-code-gif";
|
2018-06-12 18:54:44 +02:00
|
|
|
description = "Convert ASCII-armored PGP keys to animated QR code";
|
2021-03-19 06:24:59 +01:00
|
|
|
platforms = platforms.unix;
|
2018-06-12 18:54:44 +02:00
|
|
|
maintainers = with maintainers; [ asymmetric ];
|
|
|
|
};
|
|
|
|
}
|