Build pdf-simple-sign from C++ by default

This commit is contained in:
Přemysl Eric Janouch 2023-07-01 23:44:06 +02:00
parent f1ce467db5
commit 8372c2a680
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 73 additions and 50 deletions

View File

@ -1,59 +1,82 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }
, local ? false , local ? false
, full ? true , full ? true
, go ? false
}: }:
pkgs.buildGoModule rec { let
pname = "pdf-simple-sign"; common = rec {
version = "master"; pname = "pdf-simple-sign";
version = "master";
# The author recognizes that this is awful. # The author recognizes that this is awful.
# gropdf-enabled groff build was broken as of writing. # gropdf-enabled groff build was broken as of writing.
nativeCheckInputs = with pkgs; [ nativeCheckInputs = with pkgs; [
ncurses ncurses
inkscape inkscape
#(groff.override { enableGhostscript = true; }) #(groff.override { enableGhostscript = true; })
libreoffice libreoffice
imagemagick imagemagick
openssl openssl
# certutil # certutil
nss.tools nss.tools
# pdfsig # pdfsig
(poppler.override { utils = true; }) (poppler.override { utils = true; })
]; ];
src = if local then src = if local then
builtins.path { builtins.path {
path = ../${pname}/git; path = ../${pname}/git;
name = "${pname}"; name = "${pname}";
} }
else else
fetchGit { fetchGit {
url = "https://git.janouch.name/p/${pname}.git"; url = "https://git.janouch.name/p/${pname}.git";
submodules = true; submodules = true;
ref = "master"; ref = "master";
};
doCheck = true;
# libreoffice doesn't contain the lowriter script.
patchPhase = ''
sed -i 's/^lowriter/soffice --writer/' test.sh
'';
meta = with pkgs.lib; {
description = "Simple PDF signer";
homepage = "https://git.janouch.name/p/${pname}";
platforms = platforms.all;
license = licenses.bsd0;
}; };
# vendorHash = pkgs.lib.fakeHash;
vendorHash = "sha256-05h2f22TPRwadHZfueO8lXKS3Js7d8QVSOrEkY7qUZ8=";
doCheck = true;
# libreoffice doesn't contain the lowriter script.
patchPhase = ''
sed -i 's/^lowriter/soffice --writer/' test.sh
'';
checkPhase = ''
runHook preCheck
./test.sh $GOPATH/bin/pdf-simple-sign
runHook postCheck
'';
meta = with pkgs.lib; {
description = "Simple PDF signer";
homepage = "https://git.janouch.name/p/${pname}";
platforms = platforms.all;
license = licenses.bsd0;
}; };
} in if go then
pkgs.buildGoModule (common // {
# vendorHash = pkgs.lib.fakeHash;
vendorHash = "sha256-05h2f22TPRwadHZfueO8lXKS3Js7d8QVSOrEkY7qUZ8=";
checkPhase = ''
runHook preCheck
./test.sh $GOPATH/bin/pdf-simple-sign
runHook postCheck
'';
})
else
pkgs.stdenv.mkDerivation (common // {
nativeBuildInputs = with pkgs; [
meson
pkg-config
ninja
asciidoctor
];
buildInputs = with pkgs; [
openssl
];
checkPhase = ''
runHook preCheck
../test.sh ./pdf-simple-sign
runHook postCheck
'';
})