2021-02-05 17:12:51 +00:00
|
|
|
{ fetchurl, fetchpatch, lib, stdenv, pkg-config, libdaemon, dbus, perlPackages
|
2020-12-03 08:41:04 +00:00
|
|
|
, expat, gettext, intltool, glib, libiconv, writeShellScriptBin, libevent
|
2020-04-24 23:36:52 +00:00
|
|
|
, gtk3Support ? false, gtk3 ? null
|
|
|
|
, qt4 ? null
|
|
|
|
, qt4Support ? false
|
2020-12-03 08:41:04 +00:00
|
|
|
, qt5 ? null
|
|
|
|
, qt5Support ? false
|
2020-04-24 23:36:52 +00:00
|
|
|
, withLibdnssdCompat ? false
|
|
|
|
, python ? null
|
|
|
|
, withPython ? false }:
|
|
|
|
|
|
|
|
assert qt4Support -> qt4 != null;
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
let
|
|
|
|
# despite the configure script claiming it supports $PKG_CONFIG, it doesnt respect it
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config-helper = writeShellScriptBin "pkg-config" ''exec $PKG_CONFIG "$@"'';
|
2020-07-18 16:06:22 +00:00
|
|
|
in
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-02-05 17:12:51 +00:00
|
|
|
name = "avahi${lib.optionalString withLibdnssdCompat "-compat"}-${version}";
|
2020-12-03 08:41:04 +00:00
|
|
|
version = "0.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz";
|
2020-12-03 08:41:04 +00:00
|
|
|
sha256 = "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace configure \
|
|
|
|
--replace pkg-config "$PKG_CONFIG"
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
patches = [
|
|
|
|
./no-mkdir-localstatedir.patch
|
|
|
|
];
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
buildInputs = [ libdaemon dbus glib expat libiconv libevent ]
|
2020-04-24 23:36:52 +00:00
|
|
|
++ (with perlPackages; [ perl XMLParser ])
|
2021-02-05 17:12:51 +00:00
|
|
|
++ (lib.optional gtk3Support gtk3)
|
|
|
|
++ (lib.optional qt4Support qt4)
|
|
|
|
++ (lib.optional qt5Support qt5);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs =
|
2021-02-05 17:12:51 +00:00
|
|
|
lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config pkg-config-helper gettext intltool glib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags =
|
|
|
|
[ "--disable-qt3" "--disable-gdbm" "--disable-mono"
|
|
|
|
"--disable-gtk" "--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d"
|
2021-02-05 17:12:51 +00:00
|
|
|
(lib.enableFeature gtk3Support "gtk3")
|
2020-04-24 23:36:52 +00:00
|
|
|
"--${if qt4Support then "enable" else "disable"}-qt4"
|
2020-12-03 08:41:04 +00:00
|
|
|
"--${if qt5Support then "enable" else "disable"}-qt5"
|
2021-02-05 17:12:51 +00:00
|
|
|
(lib.enableFeature withPython "python")
|
2020-04-24 23:36:52 +00:00
|
|
|
"--localstatedir=/var" "--with-distro=none"
|
|
|
|
# A systemd unit is provided by the avahi-daemon NixOS module
|
|
|
|
"--with-systemdsystemunitdir=no" ]
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optional withLibdnssdCompat "--enable-compat-libdns_sd"
|
2020-04-24 23:36:52 +00:00
|
|
|
# autoipd won't build on darwin
|
2021-02-05 17:12:51 +00:00
|
|
|
++ lib.optional stdenv.isDarwin "--disable-autoipd";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
NIX_CFLAGS_COMPILE = "-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\"";
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i '20 i\
|
|
|
|
#define __APPLE_USE_RFC_2292' \
|
|
|
|
avahi-core/socket.c
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall =
|
|
|
|
# Maintain compat for mdnsresponder and howl
|
2021-02-05 17:12:51 +00:00
|
|
|
lib.optionalString withLibdnssdCompat ''
|
2020-04-24 23:36:52 +00:00
|
|
|
ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
|
|
|
|
'';
|
|
|
|
/* # these don't exist (anymore?)
|
|
|
|
ln -s avahi-compat-howl $out/include/howl
|
|
|
|
ln -s avahi-compat-howl.pc $out/lib/pkgconfig/howl.pc
|
|
|
|
*/
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "mDNS/DNS-SD implementation";
|
|
|
|
homepage = "http://avahi.org";
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ lovek323 globin ];
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Avahi is a system which facilitates service discovery on a local
|
|
|
|
network. It is an implementation of the mDNS (for "Multicast
|
|
|
|
DNS") and DNS-SD (for "DNS-Based Service Discovery")
|
|
|
|
protocols.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|