about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/si/signaturepdf/package.nix
blob: dfac73d8995070b496c09c41cd47f75e33af2679 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ lib
, stdenv
, fetchFromGitHub
, php
, makeWrapper
, imagemagick
, librsvg
, potrace
, pdftk
, ghostscript
}:

stdenv.mkDerivation rec {
  pname = "signaturepdf";
  version = "1.5.1";

  src = fetchFromGitHub {
    owner = "24eme";
    repo = "${pname}";
    rev = "v${version}";
    hash = "sha256-5isvVyT8s2ZAhLP4x/jjxDssBQ2WAvYDkGOWf3NcjHM=";
  };

  nativeBuildInputs = [ makeWrapper ];

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall
    mkdir -p $out/share/signaturepdf $out/bin

    cp --target-directory=$out/share/signaturepdf --recursive \
      app.php config locale public templates vendor

    makeWrapper ${lib.getExe php} $out/bin/signaturepdf \
      --inherit-argv0 \
      --chdir $out/share/signaturepdf \
      --prefix PATH : ${lib.makeBinPath [ imagemagick librsvg potrace pdftk ghostscript ]} \
      --run 'port=$1' \
      --run '[ $# -ge 1 ] || ( echo "Usage $0 <port> -d upload_max_filesize=24M -d post_max_size=24M -d max_file_uploads=201" >&2 && exit 1 )' \
      --run 'shift' \
      --run 'echo "You may now open a web browser on http://localhost:$port"' \
      --add-flags '-S "localhost:$port" -t public'

    runHook postInstall
  '';

  meta = with lib; {
    description = "Web software for signing PDFs and also organize pages, edit metadata and compress pdf";
    mainProgram = "signaturepdf";
    homepage = "https://pdf.24eme.fr/";
    changelog =
      "https://github.com/24eme/signaturepdf/releases/tag/v${version}";
    license = licenses.agpl3Only;
    platforms = platforms.all;
    maintainers = with maintainers; [ DamienCassou ];
  };
}