@@ -7,7 +7,7 @@
77assert stdenv.isDarwin -> ApplicationServices != null;
88
99let
10− inherit (stdenv.lib) optionals optionalString;
10+ inherit (stdenv.lib) optional optionals optionalString;
1111 raw_patch =
1212 # https://gitlab.com/graphviz/graphviz/issues/1367 CVE-2018-10196
1313 fetchpatch {
@@ -17,11 +17,13 @@ let
1717 excludes = ["tests/*"]; # we don't run them and they don't apply
1818 };
1919 # the patch needs a small adaption for older versions
20− patch = if stdenv.lib.versionAtLeast version "2.37" then raw_patch else
20+ patchToUse = if stdenv.lib.versionAtLeast version "2.37" then raw_patch else
2121 stdenv.mkDerivation {
2222 inherit (raw_patch) name;
2323 buildCommand = "sed s/dot_root/agroot/g ${raw_patch} > $out";
2424 };
25+ # 2.42 has the patch included
26+ patches = optional (stdenv.lib.versionOlder version "2.42") patchToUse;
2527in
2628
2729stdenv.mkDerivation {
@@ -52,9 +54,7 @@ stdenv.mkDerivation {
5254 "--with-ltdl-include=${libtool}/include"
5355 ] ++ stdenv.lib.optional (xorg == null) [ "--without-x" ];
5456
55− patches = [
56− patch
57− ];
57+ inherit patches;
5858
5959 postPatch = ''
6060 for f in $(find . -name Makefile.in); do