nixpkgs/pkgs/by-name/pd/pdftk/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

53 lines
1.2 KiB
Nix

{ lib, stdenv, fetchFromGitLab, gradle, jre, runtimeShell }:
stdenv.mkDerivation rec {
pname = "pdftk";
version = "3.3.3";
src = fetchFromGitLab {
owner = "pdftk-java";
repo = "pdftk";
rev = "v${version}";
hash = "sha256-ciKotTHSEcITfQYKFZ6sY2LZnXGChBJy0+eno8B3YHY=";
};
nativeBuildInputs = [ gradle ];
mitmCache = gradle.fetchDeps {
inherit pname;
data = ./deps.json;
};
__darwinAllowLocalNetworking = true;
gradleFlags = [ "-Dfile.encoding=utf-8" ];
gradleBuildTask = "shadowJar";
installPhase = ''
mkdir -p $out/{bin,share/pdftk,share/man/man1}
cp build/libs/pdftk-all.jar $out/share/pdftk
cat << EOF > $out/bin/pdftk
#!${runtimeShell}
exec ${jre}/bin/java -jar "$out/share/pdftk/pdftk-all.jar" "\$@"
EOF
chmod a+x "$out/bin/pdftk"
cp ${src}/pdftk.1 $out/share/man/man1
'';
meta = with lib; {
description = "Command-line tool for working with PDFs";
homepage = "https://gitlab.com/pdftk-java/pdftk";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # deps
];
license = licenses.gpl2Plus;
maintainers = with maintainers; [ raskin averelld ];
platforms = platforms.unix;
mainProgram = "pdftk";
};
}