6 , enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemdMinimal
16 , x11Support ? (stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin)
20 stdenv.mkDerivation rec {
25 url = "https://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.xz";
26 sha256 = "sha256-uh8h0r2dM52i1KqHgMCd8y/qh5mLc9ok9Jq53x42pQ8=";
29 patches = lib.optional stdenv.hostPlatform.isSunOS ./implement-getgrouplist.patch;
32 substituteInPlace bus/Makefile.am \
33 --replace 'install-data-hook:' 'disabled:' \
34 --replace '$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus' ':'
35 substituteInPlace tools/Makefile.am \
36 --replace 'install-data-local:' 'disabled:' \
37 --replace 'installcheck-local:' 'disabled:'
38 '' + /* cleanup of runtime references */ ''
39 substituteInPlace ./dbus/dbus-sysdeps-unix.c \
40 --replace 'DBUS_BINDIR "/dbus-launch"' "\"$lib/bin/dbus-launch\""
41 substituteInPlace ./tools/dbus-launch.c \
42 --replace 'DBUS_DAEMONDIR"/dbus-daemon"' '"/run/current-system/sw/bin/dbus-daemon"'
45 outputs = [ "out" "dev" "lib" "doc" "man" ];
46 separateDebugInfo = true;
58 propagatedBuildInputs = [
63 lib.optionals x11Support (with xorg; [
67 ]) ++ lib.optional enableSystemd systemdMinimal
68 ++ lib.optionals stdenv.hostPlatform.isLinux [ audit libapparmor ];
69 # ToDo: optional selinux?
71 __darwinAllowLocalNetworking = true;
74 "--enable-user-session"
76 "--libexecdir=${placeholder "out"}/libexec"
78 "--localstatedir=/var"
81 "--with-session-socket-dir=/tmp"
82 "--with-system-pid-file=/run/dbus/pid"
83 "--with-system-socket=/run/dbus/system_bus_socket"
84 "--with-systemdsystemunitdir=${placeholder "out"}/etc/systemd/system"
85 "--with-systemduserunitdir=${placeholder "out"}/etc/systemd/user"
86 ] ++ lib.optional (!x11Support) "--without-x"
87 ++ lib.optionals stdenv.hostPlatform.isLinux [ "--enable-apparmor" "--enable-libaudit" ]
88 ++ lib.optionals enableSystemd [ "SYSTEMCTL=${systemdMinimal}/bin/systemctl" ];
90 NIX_CFLAGS_LINK = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-Wl,--as-needed";
92 enableParallelBuilding = true;
97 # Fix paths in XML catalog broken by mismatching build/install datadir.
98 "dtddir=${placeholder "out"}/share/xml/dbus-1"
102 "sysconfdir=${placeholder "out"}/etc"
103 "datadir=${placeholder "out"}/share"
106 # it's executed from $lib by absolute path
108 moveToOutput bin/dbus-launch "$lib"
109 ln -s "$lib/bin/dbus-launch" "$out/bin/"
113 dbus-launch = "${dbus.lib}/bin/dbus-launch";
117 description = "Simple interprocess messaging system";
118 homepage = "https://www.freedesktop.org/wiki/Software/dbus/";
119 changelog = "https://gitlab.freedesktop.org/dbus/dbus/-/blob/dbus-${version}/NEWS";
120 license = licenses.gpl2Plus; # most is also under AFL-2.1
121 maintainers = teams.freedesktop.members ++ (with maintainers; [ ]);
122 platforms = platforms.unix;