avahi: format the expression

- Use `nixpkgs-fmt`.
- Order attributes according to common convention.
- Use `enableFeature` consistently.
This commit is contained in:
Jan Tojnar 2022-05-21 18:26:37 +02:00
parent 3925da79a5
commit d5cf13f483

View File

@ -1,14 +1,28 @@
{ fetchurl, fetchpatch, lib, stdenv, pkg-config, libdaemon, dbus, perlPackages { fetchurl
, expat, gettext, intltool, glib, libiconv, writeShellScriptBin, libevent , fetchpatch
, lib
, stdenv
, pkg-config
, libdaemon
, dbus
, perlPackages
, expat
, gettext
, intltool
, glib
, libiconv
, libevent
, nixosTests , nixosTests
, gtk3Support ? false, gtk3 ? null , gtk3Support ? false
, gtk3 ? null
, qt4 ? null , qt4 ? null
, qt4Support ? false , qt4Support ? false
, qt5 ? null , qt5 ? null
, qt5Support ? false , qt5Support ? false
, withLibdnssdCompat ? false , withLibdnssdCompat ? false
, python ? null , python ? null
, withPython ? false }: , withPython ? false
}:
assert qt4Support -> qt4 != null; assert qt4Support -> qt4 != null;
@ -26,46 +40,74 @@ stdenv.mkDerivation rec {
sha256 = "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6"; sha256 = "1npdixwxxn3s9q1f365x9n9rc5xgfz39hxf23faqvlrklgbhj0q6";
}; };
prePatch = ''
substituteInPlace configure \
--replace pkg-config "$PKG_CONFIG"
'';
patches = [ patches = [
./no-mkdir-localstatedir.patch ./no-mkdir-localstatedir.patch
(fetchpatch { (fetchpatch {
url = "https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c.patch"; url = "https://github.com/lathiat/avahi/commit/9d31939e55280a733d930b15ac9e4dda4497680c.patch";
sha256 = "sha256-BXWmrLWUvDxKPoIPRFBpMS3T4gijRw0J+rndp6iDybU="; sha256 = "sha256-BXWmrLWUvDxKPoIPRFBpMS3T4gijRw0J+rndp6iDybU=";
}) })
]; ];
buildInputs = [ libdaemon dbus glib expat libiconv libevent ] nativeBuildInputs = [
++ (with perlPackages; [ perl XMLParser ]) pkg-config
++ (lib.optional gtk3Support gtk3) pkg-config-helper
++ (lib.optional qt4Support qt4) gettext
++ (lib.optional qt5Support qt5); glib
];
propagatedBuildInputs = buildInputs = [
lib.optionals withPython (with python.pkgs; [ python pygobject3 dbus-python ]); libdaemon
dbus
glib
expat
libiconv
libevent
] ++ (with perlPackages; [
perl
XMLParser
]) ++ lib.optionals gtk3Support [
gtk3
] ++ lib.optionals qt4Support [
qt4
] ++ lib.optionals qt5Support [
qt5
];
nativeBuildInputs = [ pkg-config pkg-config-helper gettext intltool glib ]; propagatedBuildInputs = lib.optionals withPython (with python.pkgs; [
python
pygobject3
dbus-python
]);
configureFlags = configureFlags = [
[ "--disable-qt3" "--disable-gdbm" "--disable-mono" "--disable-qt3"
"--disable-gtk" "--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d" "--disable-gdbm"
"--disable-mono"
"--disable-gtk"
"--with-dbus-sys=${placeholder "out"}/share/dbus-1/system.d"
(lib.enableFeature gtk3Support "gtk3") (lib.enableFeature gtk3Support "gtk3")
"--${if qt4Support then "enable" else "disable"}-qt4" (lib.enableFeature qt4Support "qt4")
"--${if qt5Support then "enable" else "disable"}-qt5" (lib.enableFeature qt5Support "qt5")
(lib.enableFeature withPython "python") (lib.enableFeature withPython "python")
"--localstatedir=/var" "--with-distro=none" "--localstatedir=/var"
"--with-distro=none"
# A systemd unit is provided by the avahi-daemon NixOS module # A systemd unit is provided by the avahi-daemon NixOS module
"--with-systemdsystemunitdir=no" ] "--with-systemdsystemunitdir=no"
++ lib.optional withLibdnssdCompat "--enable-compat-libdns_sd" ] ++ lib.optionals withLibdnssdCompat [
"--enable-compat-libdns_sd"
] ++ lib.optionals stdenv.isDarwin [
# autoipd won't build on darwin # autoipd won't build on darwin
++ lib.optional stdenv.isDarwin "--disable-autoipd"; "--disable-autoipd"
];
NIX_CFLAGS_COMPILE = "-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\""; NIX_CFLAGS_COMPILE = "-DAVAHI_SERVICE_DIR=\"/etc/avahi/services\"";
prePatch = ''
substituteInPlace configure \
--replace pkg-config "$PKG_CONFIG"
'';
preBuild = lib.optionalString stdenv.isDarwin '' preBuild = lib.optionalString stdenv.isDarwin ''
sed -i '20 i\ sed -i '20 i\
#define __APPLE_USE_RFC_2292' \ #define __APPLE_USE_RFC_2292' \