From d733d5558ae79f8d2793cbc9af87ffdea230f98a Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Fri, 21 Mar 2025 10:43:43 +0100 Subject: [PATCH 1/3] graphviz: drop libXaw and libXpm dependencies The test build intended for debian [1] uses these dependencies as build time dependencies only. The arch package [2] does not use these dependencies at all. libXaw was added 11 years ago in 08131bd5d5f627f03625cf28ca8afbd7eb83e7fa. On arch, xterm links in libXaw and is used for vimdot support. However, the xterm nix package also explicitly links libXaw [3], and vimdot generally works. The build succeeds, and with vimdot working (through xwayland), this seems fully non-breaking. This change will drop libXaw from being a mass rebuild. While libXaw seems somewhat maintained, recent releases [4] are not even signed anymore, thus probably should not be a core component of nix packages. [1] https://gitlab.com/graphviz/graphviz/-/blob/2649f2366435525085cc79fb1e95ec23c84eb047/debian/control#L6 [2] https://archlinux.org/packages/extra/x86_64/graphviz/ [3] https://github.com/NixOS/nixpkgs/blob/a84ebe20c6bc2ecbcfb000a50776219f48d134cc/pkgs/by-name/xt/xterm/package.nix#L40 [4] https://gitlab.freedesktop.org/xorg/lib/libxaw/-/tags# --- pkgs/tools/graphics/graphviz/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix index d612a7f3fcdf..79f5bac7f88c 100644 --- a/pkgs/tools/graphics/graphviz/default.nix +++ b/pkgs/tools/graphics/graphviz/default.nix @@ -58,7 +58,7 @@ stdenv.mkDerivation rec { gts pango bash - ] ++ optionals withXorg (with xorg; [ libXrender libXaw libXpm ]) + ] ++ optionals withXorg (with xorg; [ libXrender ]) ++ optionals stdenv.hostPlatform.isDarwin [ ApplicationServices Foundation ]; hardeningDisable = [ "fortify" ]; From 224f4b03b673e38efbe1084cae5a7dce0624dbea Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Fri, 21 Mar 2025 11:15:22 +0100 Subject: [PATCH 2/3] graphviz: provide $PATH to vimdot vimdot expects dot to be in $PATH [1]. This meant previoiusly vimdot would only work if graphviz was in the $PATH, breaking vimdot in certain scenarios (e.g. executing `result/bin/vimdot`). Wrapping vimdot to put the graphviz output bin into PATH fixes this issue. [1] https://gitlab.com/graphviz/graphviz/-/blob/2649f2366435525085cc79fb1e95ec23c84eb047/plugin/xlib/vimdot.sh#L45 --- pkgs/tools/graphics/graphviz/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix index 79f5bac7f88c..9bc51c2183b0 100644 --- a/pkgs/tools/graphics/graphviz/default.nix +++ b/pkgs/tools/graphics/graphviz/default.nix @@ -12,6 +12,7 @@ , libjpeg , libpng , libtool +, makeWrapper , pango , bash , bison @@ -43,6 +44,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ autoreconfHook + makeWrapper pkg-config python3 bison @@ -81,9 +83,11 @@ stdenv.mkDerivation rec { postFixup = optionalString withXorg '' substituteInPlace $out/bin/vimdot \ - --replace '"/usr/bin/vi"' '"$(command -v vi)"' \ - --replace '"/usr/bin/vim"' '"$(command -v vim)"' \ - --replace /usr/bin/vimdot $out/bin/vimdot \ + --replace-warn '"/usr/bin/vi"' '"$(command -v vi)"' \ + --replace-warn '"/usr/bin/vim"' '"$(command -v vim)"' \ + --replace-warn /usr/bin/vimdot $out/bin/vimdot + + wrapProgram $out/bin/vimdot --prefix PATH : "$out/bin" ''; passthru.tests = { From 3842cc5c160bd1052d3b06fd2573590eb249fb87 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Fri, 21 Mar 2025 11:18:21 +0100 Subject: [PATCH 3/3] graphviz: nixfmt --- pkgs/tools/graphics/graphviz/default.nix | 94 +++++++++++++----------- 1 file changed, 51 insertions(+), 43 deletions(-) diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix index 9bc51c2183b0..bcd13cfff089 100644 --- a/pkgs/tools/graphics/graphviz/default.nix +++ b/pkgs/tools/graphics/graphviz/default.nix @@ -1,31 +1,32 @@ -{ lib -, stdenv -, fetchFromGitLab -, autoreconfHook -, pkg-config -, cairo -, expat -, flex -, fontconfig -, gd -, gts -, libjpeg -, libpng -, libtool -, makeWrapper -, pango -, bash -, bison -, xorg -, ApplicationServices -, Foundation -, python3 -, withXorg ? true +{ + lib, + stdenv, + fetchFromGitLab, + autoreconfHook, + pkg-config, + cairo, + expat, + flex, + fontconfig, + gd, + gts, + libjpeg, + libpng, + libtool, + makeWrapper, + pango, + bash, + bison, + xorg, + ApplicationServices, + Foundation, + python3, + withXorg ? true, -# for passthru.tests -, exiv2 -, fltk -, graphicsmagick + # for passthru.tests + exiv2, + fltk, + graphicsmagick, }: let @@ -51,17 +52,22 @@ stdenv.mkDerivation rec { flex ]; - buildInputs = [ - libpng - libjpeg - expat - fontconfig - gd - gts - pango - bash - ] ++ optionals withXorg (with xorg; [ libXrender ]) - ++ optionals stdenv.hostPlatform.isDarwin [ ApplicationServices Foundation ]; + buildInputs = + [ + libpng + libjpeg + expat + fontconfig + gd + gts + pango + bash + ] + ++ optionals withXorg (with xorg; [ libXrender ]) + ++ optionals stdenv.hostPlatform.isDarwin [ + ApplicationServices + Foundation + ]; hardeningDisable = [ "fortify" ]; @@ -72,8 +78,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - CPPFLAGS = optionalString (withXorg && stdenv.hostPlatform.isDarwin) - "-I${cairo.dev}/include/cairo"; + CPPFLAGS = optionalString (withXorg && stdenv.hostPlatform.isDarwin) "-I${cairo.dev}/include/cairo"; doCheck = false; # fails with "Graphviz test suite requires ksh93" which is not in nixpkgs @@ -96,12 +101,12 @@ stdenv.mkDerivation rec { pydot pygraphviz xdot - ; + ; inherit exiv2 fltk graphicsmagick - ; + ; }; meta = with lib; { @@ -109,6 +114,9 @@ stdenv.mkDerivation rec { description = "Graph visualization tools"; license = licenses.epl10; platforms = platforms.unix; - maintainers = with maintainers; [ bjornfor raskin ]; + maintainers = with maintainers; [ + bjornfor + raskin + ]; }; }