2022-05-21 16:26:37 +00:00
|
|
|
{ fetchurl
|
|
|
|
, fetchpatch
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, pkg-config
|
|
|
|
, libdaemon
|
|
|
|
, dbus
|
|
|
|
, perlPackages
|
|
|
|
, expat
|
|
|
|
, gettext
|
|
|
|
, glib
|
|
|
|
, libiconv
|
|
|
|
, libevent
|
2021-04-03 22:30:36 +00:00
|
|
|
, nixosTests
|
2022-05-21 16:26:37 +00:00
|
|
|
, gtk3Support ? false
|
|
|
|
, gtk3 ? null
|
2020-11-17 18:30:24 +00:00
|
|
|
, qt5 ? null
|
|
|
|
, qt5Support ? false
|
2019-04-18 05:36:26 +00:00
|
|
|
, withLibdnssdCompat ? false
|
|
|
|
, python ? null
|
2022-05-21 16:26:37 +00:00
|
|
|
, withPython ? false
|
|
|
|
}:
|
2008-02-18 20:48:36 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-02-23 22:23:24 +00:00
|
|
|
pname = "avahi${lib.optionalString withLibdnssdCompat "-compat"}";
|
2020-11-17 18:30:24 +00:00
|
|
|
version = "0.8";
|
2010-10-05 15:15:49 +00:00
|
|
|
|
2008-02-18 20:48:36 +00:00
|
|
|
src = fetchurl {
|
2016-07-01 08:21:59 +00:00
|
|
|
url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz";
|
2020-11-17 18:30:24 +00:00
|
|
|
sha256 = "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6";
|
2008-02-18 20:48:36 +00:00
|
|
|
};
|
|
|
|
|
2019-03-26 20:32:00 +00:00
|
|
|
patches = [
|
2022-10-10 07:17:41 +00:00
|
|
|
# CVE-2021-36217 / CVE-2021-3502
|
2022-03-10 10:49:13 +00:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c.patch";
|
|
|
|
sha256 = "sha256-BXWmrLWUvDxKPoIPRFBpMS3T4gijRw0J+rndp6iDybU=";
|
|
|
|
})
|
2022-10-10 07:17:41 +00:00
|
|
|
# CVE-2021-3468
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/lathiat/avahi/commit/447affe29991ee99c6b9732fc5f2c1048a611d3b.patch";
|
|
|
|
sha256 = "sha256-qWaCU1ZkCg2PmijNto7t8E3pYRN/36/9FrG8okd6Gu8=";
|
|
|
|
})
|
2019-03-26 20:32:00 +00:00
|
|
|
];
|
2010-05-08 22:24:39 +00:00
|
|
|
|
2022-05-21 16:39:02 +00:00
|
|
|
depsBuildBuild = [
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
2022-05-21 16:26:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
gettext
|
|
|
|
glib
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libdaemon
|
|
|
|
dbus
|
|
|
|
glib
|
|
|
|
expat
|
|
|
|
libiconv
|
|
|
|
libevent
|
|
|
|
] ++ (with perlPackages; [
|
|
|
|
perl
|
|
|
|
XMLParser
|
|
|
|
]) ++ lib.optionals gtk3Support [
|
|
|
|
gtk3
|
|
|
|
] ++ lib.optionals qt5Support [
|
|
|
|
qt5
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = lib.optionals withPython (with python.pkgs; [
|
|
|
|
python
|
|
|
|
pygobject3
|
|
|
|
dbus-python
|
|
|
|
]);
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--disable-gdbm"
|
|
|
|
"--disable-mono"
|
2022-05-21 16:51:24 +00:00
|
|
|
# Use non-deprecated path https://github.com/lathiat/avahi/pull/376
|
2022-05-21 16:26:37 +00:00
|
|
|
"--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d"
|
|
|
|
(lib.enableFeature gtk3Support "gtk3")
|
|
|
|
(lib.enableFeature qt5Support "qt5")
|
|
|
|
(lib.enableFeature withPython "python")
|
|
|
|
"--localstatedir=/var"
|
2022-05-21 16:51:24 +00:00
|
|
|
"--runstatedir=/run"
|
|
|
|
"--sysconfdir=/etc"
|
2022-05-21 16:26:37 +00:00
|
|
|
"--with-distro=none"
|
|
|
|
# A systemd unit is provided by the avahi-daemon NixOS module
|
|
|
|
"--with-systemdsystemunitdir=no"
|
|
|
|
] ++ lib.optionals withLibdnssdCompat [
|
|
|
|
"--enable-compat-libdns_sd"
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2013-07-07 10:35:25 +00:00
|
|
|
# autoipd won't build on darwin
|
2022-05-21 16:26:37 +00:00
|
|
|
"--disable-autoipd"
|
|
|
|
];
|
2013-07-07 10:35:25 +00:00
|
|
|
|
2022-05-21 16:51:24 +00:00
|
|
|
installFlags = [
|
|
|
|
# Override directories to install into the package.
|
|
|
|
# Replace with runstatedir once is merged https://github.com/lathiat/avahi/pull/377
|
|
|
|
"avahi_runtime_dir=${placeholder "out"}/run"
|
|
|
|
"sysconfdir=${placeholder "out"}/etc"
|
|
|
|
];
|
2019-05-22 18:46:10 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
preBuild = lib.optionalString stdenv.isDarwin ''
|
2013-07-07 10:35:25 +00:00
|
|
|
sed -i '20 i\
|
|
|
|
#define __APPLE_USE_RFC_2292' \
|
|
|
|
avahi-core/socket.c
|
|
|
|
'';
|
|
|
|
|
2016-01-01 09:01:36 +00:00
|
|
|
postInstall =
|
2022-05-21 16:17:49 +00:00
|
|
|
# Maintain compat for mdnsresponder
|
2021-01-21 17:00:13 +00:00
|
|
|
lib.optionalString withLibdnssdCompat ''
|
2016-01-01 09:01:36 +00:00
|
|
|
ln -s avahi-compat-libdns_sd/dns_sd.h "$out/include/dns_sd.h"
|
|
|
|
'';
|
2013-12-03 01:48:20 +00:00
|
|
|
|
2021-04-03 22:30:36 +00:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.avahi;
|
|
|
|
smoke-test-resolved = nixosTests.avahi-with-resolved;
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2013-10-05 14:22:46 +00:00
|
|
|
description = "mDNS/DNS-SD implementation";
|
2022-05-21 16:26:37 +00:00
|
|
|
homepage = "http://avahi.org";
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
platforms = platforms.unix;
|
2019-08-20 17:36:05 +00:00
|
|
|
maintainers = with maintainers; [ lovek323 globin ];
|
2013-07-07 10:35:25 +00:00
|
|
|
|
2008-03-20 14:35:03 +00:00
|
|
|
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.
|
|
|
|
'';
|
2008-02-18 20:48:36 +00:00
|
|
|
};
|
|
|
|
}
|