nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at netboot-syslinux-multiplatform 142 lines 3.6 kB view raw
1{ fetchurl 2, fetchpatch 3, lib 4, stdenv 5, pkg-config 6, libdaemon 7, dbus 8, perlPackages 9, libpcap 10, expat 11, gettext 12, glib 13, libiconv 14, libevent 15, nixosTests 16, gtk3Support ? false 17, gtk3 18, qt5 19, qt5Support ? false 20, withLibdnssdCompat ? false 21, python ? null 22, withPython ? false 23}: 24 25stdenv.mkDerivation rec { 26 pname = "avahi${lib.optionalString withLibdnssdCompat "-compat"}"; 27 version = "0.8"; 28 29 src = fetchurl { 30 url = "https://github.com/lathiat/avahi/releases/download/v${version}/avahi-${version}.tar.gz"; 31 sha256 = "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6"; 32 }; 33 34 outputs = [ "out" "dev" "man" ]; 35 36 patches = [ 37 # CVE-2021-36217 / CVE-2021-3502 38 (fetchpatch { 39 url = "https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c.patch"; 40 sha256 = "sha256-BXWmrLWUvDxKPoIPRFBpMS3T4gijRw0J+rndp6iDybU="; 41 }) 42 # CVE-2021-3468 43 (fetchpatch { 44 url = "https://github.com/lathiat/avahi/commit/447affe29991ee99c6b9732fc5f2c1048a611d3b.patch"; 45 sha256 = "sha256-qWaCU1ZkCg2PmijNto7t8E3pYRN/36/9FrG8okd6Gu8="; 46 }) 47 ]; 48 49 depsBuildBuild = [ 50 pkg-config 51 ]; 52 53 nativeBuildInputs = [ 54 pkg-config 55 gettext 56 glib 57 ]; 58 59 buildInputs = [ 60 libdaemon 61 dbus 62 glib 63 expat 64 libiconv 65 libevent 66 ] ++ (with perlPackages; [ 67 perl 68 XMLParser 69 ]) ++ lib.optionals stdenv.isFreeBSD [ 70 libpcap 71 ] ++ lib.optionals gtk3Support [ 72 gtk3 73 ] ++ lib.optionals qt5Support [ 74 qt5 75 ]; 76 77 propagatedBuildInputs = lib.optionals withPython (with python.pkgs; [ 78 python 79 pygobject3 80 dbus-python 81 ]); 82 83 configureFlags = [ 84 "--disable-gdbm" 85 "--disable-mono" 86 # Use non-deprecated path https://github.com/lathiat/avahi/pull/376 87 "--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d" 88 (lib.enableFeature gtk3Support "gtk3") 89 (lib.enableFeature qt5Support "qt5") 90 (lib.enableFeature withPython "python") 91 "--localstatedir=/var" 92 "--runstatedir=/run" 93 "--sysconfdir=/etc" 94 "--with-distro=${with stdenv.hostPlatform; if isBSD then parsed.kernel.name else "none"}" 95 # A systemd unit is provided by the avahi-daemon NixOS module 96 "--with-systemdsystemunitdir=no" 97 ] ++ lib.optionals withLibdnssdCompat [ 98 "--enable-compat-libdns_sd" 99 ] ++ lib.optionals stdenv.isDarwin [ 100 # autoipd won't build on darwin 101 "--disable-autoipd" 102 ]; 103 104 installFlags = [ 105 # Override directories to install into the package. 106 # Replace with runstatedir once is merged https://github.com/lathiat/avahi/pull/377 107 "avahi_runtime_dir=${placeholder "out"}/run" 108 "sysconfdir=${placeholder "out"}/etc" 109 ]; 110 111 preBuild = lib.optionalString stdenv.isDarwin '' 112 sed -i '20 i\ 113 #define __APPLE_USE_RFC_2292' \ 114 avahi-core/socket.c 115 ''; 116 117 postInstall = 118 # Maintain compat for mdnsresponder 119 lib.optionalString withLibdnssdCompat '' 120 ln -s avahi-compat-libdns_sd/dns_sd.h "$dev/include/dns_sd.h" 121 ''; 122 123 passthru.tests = { 124 smoke-test = nixosTests.avahi; 125 smoke-test-resolved = nixosTests.avahi-with-resolved; 126 }; 127 128 meta = with lib; { 129 description = "mDNS/DNS-SD implementation"; 130 homepage = "http://avahi.org"; 131 license = licenses.lgpl2Plus; 132 platforms = platforms.unix; 133 maintainers = with maintainers; [ lovek323 globin ]; 134 135 longDescription = '' 136 Avahi is a system which facilitates service discovery on a local 137 network. It is an implementation of the mDNS (for "Multicast 138 DNS") and DNS-SD (for "DNS-Based Service Discovery") 139 protocols. 140 ''; 141 }; 142}