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,8 +1,10 @@
{ pkgs ? import <nixpkgs> { } { pkgs ? import <nixpkgs> { }
, local ? false , local ? false
, full ? true , full ? true
, go ? false
}: }:
pkgs.buildGoModule rec { let
common = rec {
pname = "pdf-simple-sign"; pname = "pdf-simple-sign";
version = "master"; version = "master";
@ -34,9 +36,6 @@ pkgs.buildGoModule rec {
ref = "master"; ref = "master";
}; };
# vendorHash = pkgs.lib.fakeHash;
vendorHash = "sha256-05h2f22TPRwadHZfueO8lXKS3Js7d8QVSOrEkY7qUZ8=";
doCheck = true; doCheck = true;
# libreoffice doesn't contain the lowriter script. # libreoffice doesn't contain the lowriter script.
@ -44,16 +43,40 @@ pkgs.buildGoModule rec {
sed -i 's/^lowriter/soffice --writer/' test.sh sed -i 's/^lowriter/soffice --writer/' test.sh
''; '';
checkPhase = ''
runHook preCheck
./test.sh $GOPATH/bin/pdf-simple-sign
runHook postCheck
'';
meta = with pkgs.lib; { meta = with pkgs.lib; {
description = "Simple PDF signer"; description = "Simple PDF signer";
homepage = "https://git.janouch.name/p/${pname}"; homepage = "https://git.janouch.name/p/${pname}";
platforms = platforms.all; platforms = platforms.all;
license = licenses.bsd0; 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
'';
})