Unverified Commit c1340430 authored by asymmetric's avatar asymmetric Committed by GitHub
Browse files

Merge pull request #325091 from NotAShelf/cl-asc-key-to-qr-code-gif

asc-key-to-qr-code-gif: move to by-name; cleanup; update to 0-unstable-2019-01-27
parents a25848c9 5c7eddd3
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  fetchFromGitHub,
  imagemagick,
  qrencode,
  testQR ? false,
  zbar ? null,
}:
assert testQR -> zbar != false;
stdenvNoCC.mkDerivation {
  pname = "asc-key-to-qr-code-gif";
  version = "0-unstable-2019-01-27";

  src = fetchFromGitHub {
    owner = "yishilin14";
    repo = "asc-key-to-qr-code-gif";
    rev = "5d36a1bada8646ae0f61b04356e62ba5ef10a1aa";
    sha256 = "sha256-DwxYgBsioL86WM6KBFJ+DuSJo3/1pwD1Fl156XD98RY=";
  };

  dontBuild = true;

  postPatch =
    let
      substitutions =
        [
          ''--replace-fail "convert" "${lib.getExe imagemagick}"''
          ''--replace-fail "qrencode" "${lib.getExe qrencode}"''
        ]
        ++ lib.optionals testQR [
          ''--replace-fail "hash zbarimg" "true"'' # hash does not work on NixOS
          ''--replace-fail "$(zbarimg --raw" "$(${zbar}/bin/zbarimg --raw"''
        ];
    in
    ''
      substituteInPlace asc-to-gif.sh ${lib.concatStringsSep " " substitutions}
    '';

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp asc-to-gif.sh $out/bin/asc-to-gif
    runHook postInstall
  '';

  meta = {
    homepage = "https://github.com/yishilin14/asc-key-to-qr-code-gif";
    description = "Convert ASCII-armored PGP keys to animated QR code";
    license = lib.licenses.unfree; # program does not have a license
    mainProgram = "asc-to-gif";
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [
      asymmetric
      NotAShelf
    ];
  };
}
+0 −46
Original line number Diff line number Diff line
{ lib, stdenv, fetchFromGitHub, imagemagick, qrencode
, testQR ? false, zbar ? null
}:

assert testQR -> zbar != false;

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

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

  dontBuild = true;
  dontStrip = true;
  dontPatchELF = true;

  preInstall = let
    substitutions = [
      ''--replace "convert" "${imagemagick}/bin/convert"''
      ''--replace "qrencode" "${qrencode.bin}/bin/qrencode"''
    ] ++ lib.optionals testQR [
      ''--replace "hash zbarimg" "true"'' # hash does not work on NixOS
      ''--replace "$(zbarimg --raw" "$(${zbar.out}/bin/zbarimg --raw"''
    ];
  in ''
    substituteInPlace asc-to-gif.sh ${lib.concatStringsSep " " substitutions}
  '';

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

  meta = with lib; {
    homepage = "https://github.com/yishilin14/asc-key-to-qr-code-gif";
    description = "Convert ASCII-armored PGP keys to animated QR code";
    mainProgram = "asc-to-gif.sh";
    platforms = platforms.unix;
    maintainers = with maintainers; [ asymmetric ];
  };
}
+0 −2
Original line number Diff line number Diff line
@@ -3919,8 +3919,6 @@ with pkgs;
  xjadeo = callPackage ../tools/video/xjadeo { };
  asc-key-to-qr-code-gif = callPackage ../tools/security/asc-key-to-qr-code-gif { };
  go-audit = callPackage ../tools/system/go-audit { };
  gopass = callPackage ../tools/security/gopass { };