2023-06-29 02:31:03 +02:00
|
|
|
{ pkgs ? import <nixpkgs> { }
|
|
|
|
, local ? false
|
|
|
|
, full ? true
|
2023-07-01 23:44:06 +02:00
|
|
|
, go ? false
|
2023-06-29 02:31:03 +02:00
|
|
|
}:
|
2023-07-01 23:44:06 +02:00
|
|
|
let
|
|
|
|
common = rec {
|
|
|
|
pname = "pdf-simple-sign";
|
|
|
|
version = "master";
|
|
|
|
|
|
|
|
# The author recognizes that this is awful.
|
|
|
|
# gropdf-enabled groff build was broken as of writing.
|
|
|
|
nativeCheckInputs = with pkgs; [
|
|
|
|
ncurses
|
|
|
|
inkscape
|
|
|
|
#(groff.override { enableGhostscript = true; })
|
|
|
|
imagemagick
|
2023-06-29 02:31:03 +02:00
|
|
|
|
2023-07-01 23:44:06 +02:00
|
|
|
openssl
|
|
|
|
# certutil
|
|
|
|
nss.tools
|
|
|
|
# pdfsig
|
|
|
|
(poppler.override { utils = true; })
|
2023-07-04 03:00:23 +02:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
# Missing on macOS as of writing.
|
|
|
|
libreoffice
|
2023-07-01 23:44:06 +02:00
|
|
|
];
|
2023-06-29 02:31:03 +02:00
|
|
|
|
2023-07-01 23:44:06 +02:00
|
|
|
src = if local then
|
|
|
|
builtins.path {
|
|
|
|
path = ../${pname}/git;
|
|
|
|
name = "${pname}";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fetchGit {
|
|
|
|
url = "https://git.janouch.name/p/${pname}.git";
|
|
|
|
submodules = true;
|
|
|
|
ref = "master";
|
|
|
|
};
|
2023-06-29 02:31:03 +02:00
|
|
|
|
2023-07-01 23:44:06 +02:00
|
|
|
doCheck = true;
|
2023-06-29 02:31:03 +02:00
|
|
|
|
2023-07-01 23:44:06 +02:00
|
|
|
# libreoffice doesn't contain the lowriter script.
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i 's/^lowriter/soffice --writer/' test.sh
|
|
|
|
'';
|
2023-06-29 02:31:03 +02:00
|
|
|
|
2023-07-01 23:44:06 +02:00
|
|
|
meta = with pkgs.lib; {
|
|
|
|
description = "Simple PDF signer";
|
|
|
|
homepage = "https://git.janouch.name/p/${pname}";
|
|
|
|
platforms = platforms.all;
|
|
|
|
license = licenses.bsd0;
|
|
|
|
};
|
2023-06-29 02:31:03 +02:00
|
|
|
};
|
2023-07-01 23:44:06 +02:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
})
|