4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
50 lines
1.4 KiB
Nix
50 lines
1.4 KiB
Nix
{ lib, stdenv, makeDesktopItem, fetchurl, jdk11, wrapGAppsHook, glib }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "pdfsam-basic";
|
|
version = "4.2.1";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/torakiki/pdfsam/releases/download/v${version}/pdfsam_${version}-1_amd64.deb";
|
|
sha256 = "0d7pvl87ybkvcxk69fr35fz0w447hy2pm65bhvlril16ljm2izja";
|
|
};
|
|
|
|
unpackPhase = ''
|
|
ar vx ${src}
|
|
tar xvf data.tar.gz
|
|
'';
|
|
|
|
nativeBuildInputs = [ wrapGAppsHook ];
|
|
buildInputs = [ glib ];
|
|
|
|
preFixup = ''
|
|
gappsWrapperArgs+=(--set JAVA_HOME "${jdk11}" --set PDFSAM_JAVA_PATH "${jdk11}")
|
|
'';
|
|
|
|
installPhase = ''
|
|
cp -R opt/pdfsam-basic/ $out/
|
|
mkdir -p "$out"/share/icons
|
|
cp --recursive ${desktopItem}/share/applications $out/share
|
|
cp $out/icon.svg "$out"/share/icons/pdfsam-basic.svg
|
|
'';
|
|
|
|
desktopItem = makeDesktopItem {
|
|
name = pname;
|
|
exec = pname;
|
|
icon = pname;
|
|
comment = meta.description;
|
|
desktopName = "PDFsam Basic";
|
|
genericName = "PDF Split and Merge";
|
|
mimeType = "application/pdf;";
|
|
categories = "Office;";
|
|
};
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/torakiki/pdfsam";
|
|
description = "Multi-platform software designed to extract pages, split, merge, mix and rotate PDF files";
|
|
license = licenses.agpl3;
|
|
platforms = platforms.all;
|
|
maintainers = with maintainers; [ _1000101 ];
|
|
};
|
|
}
|