graphviz: fix missing lib/graphviz/config6, enable strictDeps

fixes `$(nix-build -A pkgsCross.musl64.graphviz)/bin/dot < /dev/null)`

without `config6`, a cross-compiled graphviz wouldn't know which plugins
it had available, and so any `dot` command would fail like:
```
$ dot
There is no layout engine support for "dot"
Perhaps "dot -c" needs to be run (with installer's privileges) to register the plugins?
```
This commit is contained in:
Colin
2026-03-30 18:32:24 +00:00
parent 96720dc0ea
commit d06b4bd89b
+27 -3
View File
@@ -4,6 +4,7 @@
fetchFromGitLab,
autoreconfHook,
pkg-config,
buildPackages,
cairo,
expat,
flex,
@@ -15,6 +16,7 @@
libtool,
makeWrapper,
pango,
runCommand,
bash,
bison,
libxrender,
@@ -35,14 +37,14 @@ let
optionalAttrs
;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "graphviz";
version = "12.2.1";
src = fetchFromGitLab {
owner = "graphviz";
repo = "graphviz";
rev = version;
rev = finalAttrs.version;
hash = "sha256-Uxqg/7+LpSGX4lGH12uRBxukVw0IswFPfpb2EkLsaiI=";
};
@@ -77,6 +79,7 @@ stdenv.mkDerivation rec {
++ optional false "--without-x";
enableParallelBuilding = true;
strictDeps = true;
env = optionalAttrs (withXorg && stdenv.hostPlatform.isDarwin) {
CPPFLAGS = "-I${cairo.dev}/include/cairo";
@@ -88,6 +91,19 @@ stdenv.mkDerivation rec {
./autogen.sh
'';
# Invoke `dot -c` even while cross compiling else lib/graphviz/config6 will not load at runtime.
postPatch = ''
substituteInPlace cmd/dot/Makefile.am --replace-fail \
'if test "x$(DESTDIR)" = "x" -a "x$(build)" = "x$(host)"; then if test -x $(bindir)/dot$(EXEEXT); then if test -x /sbin/ldconfig; then /sbin/ldconfig 2>/dev/null; fi; cd $(bindir); ./dot$(EXEEXT) -c; else cd $(bindir); ./dot_static$(EXEEXT) -c; fi; fi' \
'${lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) ''
if test -x $(bindir)/dot$(EXEEXT); then \
cd $(bindir); ${stdenv.hostPlatform.emulator buildPackages} ./dot$(EXEEXT) -c; \
else \
cd $(bindir); ${stdenv.hostPlatform.emulator buildPackages} ./dot_static$(EXEEXT) -c; \
fi
''}'
'';
postFixup = optionalString withXorg ''
substituteInPlace $out/bin/vimdot \
--replace-warn '"/usr/bin/vi"' '"$(command -v vi)"' \
@@ -109,6 +125,14 @@ stdenv.mkDerivation rec {
fltk
graphicsmagick
;
dot-can-load-plugins =
runCommand "dot-can-load-plugins"
{
nativeBuildInputs = [ finalAttrs.finalPackage ];
}
''
dot -P -o $out
'';
};
meta = {
@@ -121,4 +145,4 @@ stdenv.mkDerivation rec {
raskin
];
};
}
})