libinfinity: modernize expression

* Use multiple outputs to reduce the number of rebuilds necessary.
* Fix build with GTK+ support
This commit is contained in:
Jan Tojnar 2018-08-08 01:31:21 +02:00
parent 2428f5dda1
commit 4ce95e453b
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
3 changed files with 49 additions and 50 deletions

View File

@ -10,8 +10,8 @@ in {
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.libinfinity.override { daemon = true; }; default = pkgs.libinfinity;
defaultText = "pkgs.libinfinity.override { daemon = true; }"; defaultText = "pkgs.libinfinity";
description = '' description = ''
Package providing infinoted Package providing infinoted
''; '';
@ -129,7 +129,7 @@ in {
serviceConfig = { serviceConfig = {
Type = "simple"; Type = "simple";
Restart = "always"; Restart = "always";
ExecStart = "${cfg.package}/bin/infinoted-${versions.majorMinor cfg.package.version} --config-file=/var/lib/infinoted/infinoted.conf"; ExecStart = "${cfg.package.infinoted} --config-file=/var/lib/infinoted/infinoted.conf";
User = cfg.user; User = cfg.user;
Group = cfg.group; Group = cfg.group;
PermissionsStartOnly = true; PermissionsStartOnly = true;

View File

@ -1,17 +1,17 @@
{ gtkWidgets ? false # build GTK widgets for libinfinity { gtkWidgets ? false # build GTK widgets for libinfinity
, daemon ? false # build infinote daemon
, documentation ? false # build documentation
, avahiSupport ? false # build support for Avahi in libinfinity , avahiSupport ? false # build support for Avahi in libinfinity
, stdenv, fetchurl, pkgconfig, glib, libxml2, gnutls, gsasl , stdenv, fetchurl, pkgconfig, glib, libxml2, gnutls, gsasl
, gtk2 ? null, gtkdoc ? null, avahi ? null, libdaemon ? null, libidn, gss , gobjectIntrospection
, gtk3 ? null, gtk-doc, docbook_xsl, docbook_xml_dtd_412, avahi ? null, libdaemon, libidn, gss
, libintl }: , libintl }:
assert avahiSupport -> avahi != null;
assert gtkWidgets -> gtk3 != null;
let let
edf = flag: feature: (if flag then "--with-" else "--without-") + feature; mkFlag = flag: feature: (if flag then "--with-" else "--without-") + feature;
optional = cond: elem: assert cond -> elem != null; if cond then [elem] else [];
in stdenv.mkDerivation rec {
self = stdenv.mkDerivation rec {
name = "libinfinity-${version}"; name = "libinfinity-${version}";
version = "0.7.1"; version = "0.7.1";
src = fetchurl { src = fetchurl {
@ -19,26 +19,27 @@ in stdenv.mkDerivation rec {
sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2"; sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2";
}; };
nativeBuildInputs = [ pkgconfig ]; outputs = [ "bin" "out" "dev" "man" "devdoc" ];
buildInputs = [ glib libxml2 gsasl libidn gss libintl ]
++ optional gtkWidgets gtk2 nativeBuildInputs = [ pkgconfig gtk-doc docbook_xsl docbook_xml_dtd_412 gobjectIntrospection ];
++ optional documentation gtkdoc buildInputs = [ glib libxml2 gsasl libidn gss libintl libdaemon ]
++ optional avahiSupport avahi ++ stdenv.lib.optional gtkWidgets gtk3
++ optional daemon libdaemon; ++ stdenv.lib.optional avahiSupport avahi;
propagatedBuildInputs = [ gnutls ]; propagatedBuildInputs = [ gnutls ];
configureFlags = '' configureFlags = [
${if documentation then "--enable-gtk-doc" else "--disable-gtk-doc"} "--enable-gtk-doc"
${edf gtkWidgets "inftextgtk"} "--enable-introspection"
${edf gtkWidgets "infgtk"} (mkFlag gtkWidgets "inftextgtk")
${edf daemon "infinoted"} (mkFlag gtkWidgets "infgtk")
${edf daemon "libdaemon"} "--with-infinoted"
${edf avahiSupport "avahi"} "--with-libdaemon"
''; (mkFlag avahiSupport "avahi")
];
passthru = { passthru = {
inherit version; infinoted = "${self.bin}/bin/infinoted-${stdenv.lib.versions.majorMinor version}";
}; };
meta = { meta = {
@ -48,5 +49,5 @@ in stdenv.mkDerivation rec {
maintainers = [ stdenv.lib.maintainers.phreedom ]; maintainers = [ stdenv.lib.maintainers.phreedom ];
platforms = with stdenv.lib.platforms; linux ++ darwin; platforms = with stdenv.lib.platforms; linux ++ darwin;
}; };
};
} in self

View File

@ -10471,9 +10471,7 @@ with pkgs;
libiec61883 = callPackage ../development/libraries/libiec61883 { }; libiec61883 = callPackage ../development/libraries/libiec61883 { };
libinfinity = callPackage ../development/libraries/libinfinity { libinfinity = callPackage ../development/libraries/libinfinity { };
inherit (gnome2) gtkdoc;
};
libinput = callPackage ../development/libraries/libinput { libinput = callPackage ../development/libraries/libinput {
graphviz = graphviz-nox; graphviz = graphviz-nox;