about summary refs log tree commit diff
path: root/pkgs/applications/graphics
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-06-26 14:44:51 +0200
committerGitHub <noreply@github.com>2021-06-26 14:44:51 +0200
commit69015ede61fc27b7efa2a2f6241286a0b7e64720 (patch)
tree6275149e5de478408f9ca334038ecca5054eca5c /pkgs/applications/graphics
parent64d2892c925212675e307ba4b31268eba7064add (diff)
parent5efd65b2d94b0ac0cf155e013b6747fa22bc04c3 (diff)
Merge pull request #128037 from jtojnar/inkscape-app-trans
inkscape-extensions.applytransforms: 0.0.0+unstable=2021-05-11
Diffstat (limited to 'pkgs/applications/graphics')
-rw-r--r--pkgs/applications/graphics/inkscape/default.nix10
-rw-r--r--pkgs/applications/graphics/inkscape/extensions.nix3
-rw-r--r--pkgs/applications/graphics/inkscape/extensions/applytransforms/default.nix42
-rw-r--r--pkgs/applications/graphics/inkscape/with-extensions.nix10
4 files changed, 63 insertions, 2 deletions
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 813db0984751a..c65dfa1b6c085 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -4,6 +4,7 @@
 , cairo
 , cmake
 , fetchurl
+, fetchpatch
 , gettext
 , ghostscript
 , glib
@@ -71,6 +72,15 @@ stdenv.mkDerivation rec {
       # e.g., those from the "Effects" menu.
       python3 = "${python3Env}/bin/python";
     })
+
+    # Fix parsing paths by Python extensions.
+    # https://gitlab.com/inkscape/extensions/-/merge_requests/342
+    (fetchpatch {
+      url = "https://gitlab.com/inkscape/extensions/-/commit/a82c382c610d37837c8f3f5b13224bab8fd3667e.patch";
+      sha256 = "YWrgjCnQ9q6BUsxSLQojIXnDzPxM/SgrIfj1gxQ/JKM=";
+      stripLen = 1;
+      extraPrefix = "share/extensions/";
+    })
   ];
 
   postPatch = ''
diff --git a/pkgs/applications/graphics/inkscape/extensions.nix b/pkgs/applications/graphics/inkscape/extensions.nix
index affd934e93682..63010a19f14db 100644
--- a/pkgs/applications/graphics/inkscape/extensions.nix
+++ b/pkgs/applications/graphics/inkscape/extensions.nix
@@ -2,9 +2,12 @@
 , fetchFromGitHub
 , runCommand
 , inkcut
+, callPackage
 }:
 
 {
+  applytransforms = callPackage ./extensions/applytransforms { };
+
   hexmap = stdenv.mkDerivation {
     name = "hexmap";
     version = "2020-06-06";
diff --git a/pkgs/applications/graphics/inkscape/extensions/applytransforms/default.nix b/pkgs/applications/graphics/inkscape/extensions/applytransforms/default.nix
new file mode 100644
index 0000000000000..131daffffb9d4
--- /dev/null
+++ b/pkgs/applications/graphics/inkscape/extensions/applytransforms/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, python3
+}:
+
+stdenv.mkDerivation {
+  pname = "inkscape-applytransforms";
+  version = "0.0.0+unstable=2021-05-11";
+
+  src = fetchFromGitHub {
+    owner = "Klowner";
+    repo = "inkscape-applytransforms";
+    rev = "5b3ed4af0fb66e399e686fc2b649b56db84f6042";
+    sha256 = "XWwkuw+Um/cflRWjIeIgQUxJLrk2DLDmx7K+pMWvIlI=";
+  };
+
+  checkInputs = [
+    python3.pkgs.inkex
+    python3.pkgs.pytestCheckHook
+  ];
+
+  dontBuild = true;
+
+  doCheck = true;
+
+  installPhase = ''
+    runHook preInstall
+
+    install -Dt "$out/share/inkscape/extensions" *.inx *.py
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Inkscape extension which removes all matrix transforms by applying them recursively to shapes";
+    homepage = "https://github.com/Klowner/inkscape-applytransforms";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/applications/graphics/inkscape/with-extensions.nix b/pkgs/applications/graphics/inkscape/with-extensions.nix
index c558a6bb06225..14fffadd03606 100644
--- a/pkgs/applications/graphics/inkscape/with-extensions.nix
+++ b/pkgs/applications/graphics/inkscape/with-extensions.nix
@@ -2,13 +2,19 @@
 , inkscape
 , symlinkJoin
 , makeWrapper
-, inkscapeExtensions ? []
+, inkscapeExtensions ? [ ]
+, inkscape-extensions
 }:
 
+let
+  allExtensions = lib.filter (pkg: lib.isDerivation pkg && !pkg.meta.broken or false) (lib.attrValues inkscape-extensions);
+  selectedExtensions = if inkscapeExtensions == null then allExtensions else inkscapeExtensions;
+in
+
 symlinkJoin {
   name = "inkscape-with-extensions-${lib.getVersion inkscape}";
 
-  paths = [ inkscape ] ++ inkscapeExtensions;
+  paths = [ inkscape ] ++ selectedExtensions;
 
   nativeBuildInputs = [ makeWrapper ];