about summary refs log tree commit diff
path: root/pkgs/by-name/de
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/de')
-rwxr-xr-xpkgs/by-name/de/densify/package.nix78
1 files changed, 78 insertions, 0 deletions
diff --git a/pkgs/by-name/de/densify/package.nix b/pkgs/by-name/de/densify/package.nix
new file mode 100755
index 000000000000..0b2e1c314371
--- /dev/null
+++ b/pkgs/by-name/de/densify/package.nix
@@ -0,0 +1,78 @@
+{
+  fetchFromGitHub,
+  lib,
+  python3Packages,
+  python3,
+  gtk3,
+  gobject-introspection,
+  wrapGAppsHook3,
+  xorg,
+  gnugrep,
+  ghostscript,
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "densify";
+  version = "0.3.2";
+  format = "other";
+
+  src = fetchFromGitHub {
+    owner = "hkdb";
+    repo = "Densify";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-giFFy8HiSmnOqFKLyrPD1kTry8hMQxotEgD/u2FEMRY=";
+  };
+
+  postPatch = ''
+    # Fix fail loading program icon from runtime path
+    substituteInPlace densify \
+      --replace-fail "/icon.png" "/../share/densify/icon.png"
+  '';
+
+  dependencies = with python3Packages; [ pygobject3 ];
+
+  nativeBuildInputs = [
+    gobject-introspection
+    wrapGAppsHook3
+  ];
+
+  buildInputs = [ gtk3 ];
+
+  preFixup = ''
+    gappsWrapperArgs+=(
+      --prefix PATH : "${
+        lib.makeBinPath [
+          ghostscript
+          gnugrep
+          xorg.xrandr
+        ]
+      }"
+    )
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 -t $out/bin densify
+    install -Dm644 -t $out/share/applications densify.desktop
+    install -Dm644 -t $out/share/densify desktop-icon.png icon.png
+
+    runHook postInstall
+  '';
+
+  postFixup = ''
+    substituteInPlace $out/share/applications/densify.desktop \
+      --replace-fail "/opt/Densify/densify" "densify" \
+      --replace-fail "Path=/opt/Densify/" "Path=$out/bin/" \
+      --replace-fail "/opt/Densify/desktop-icon.png" "$out/share/densify/desktop-icon.png"
+  '';
+
+  meta = {
+    description = "Compress PDF files with Ghostscript";
+    homepage = "https://github.com/hkdb/Densify";
+    changelog = "https://github.com/hkdb/Densify/blob/${src.rev}/README.md";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ onny ];
+    platforms = lib.platforms.all;
+  };
+}