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
''; '';
@ -119,7 +119,7 @@ in {
users.groups = optional (cfg.group == "infinoted") users.groups = optional (cfg.group == "infinoted")
{ name = "infinoted"; { name = "infinoted";
}; };
systemd.services.infinoted = systemd.services.infinoted =
{ description = "Gobby Dedicated Server"; { description = "Gobby Dedicated Server";
@ -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,52 +1,53 @@
{ 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}";
version = "0.7.1";
src = fetchurl {
url = "http://releases.0x539.de/libinfinity/${name}.tar.gz";
sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2";
};
name = "libinfinity-${version}"; outputs = [ "bin" "out" "dev" "man" "devdoc" ];
version = "0.7.1";
src = fetchurl { nativeBuildInputs = [ pkgconfig gtk-doc docbook_xsl docbook_xml_dtd_412 gobjectIntrospection ];
url = "http://releases.0x539.de/libinfinity/${name}.tar.gz"; buildInputs = [ glib libxml2 gsasl libidn gss libintl libdaemon ]
sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2"; ++ stdenv.lib.optional gtkWidgets gtk3
++ stdenv.lib.optional avahiSupport avahi;
propagatedBuildInputs = [ gnutls ];
configureFlags = [
"--enable-gtk-doc"
"--enable-introspection"
(mkFlag gtkWidgets "inftextgtk")
(mkFlag gtkWidgets "infgtk")
"--with-infinoted"
"--with-libdaemon"
(mkFlag avahiSupport "avahi")
];
passthru = {
infinoted = "${self.bin}/bin/infinoted-${stdenv.lib.versions.majorMinor version}";
};
meta = {
homepage = http://gobby.0x539.de/;
description = "An implementation of the Infinote protocol written in GObject-based C";
license = stdenv.lib.licenses.lgpl2Plus;
maintainers = [ stdenv.lib.maintainers.phreedom ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}; };
in self
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ glib libxml2 gsasl libidn gss libintl ]
++ optional gtkWidgets gtk2
++ optional documentation gtkdoc
++ optional avahiSupport avahi
++ optional daemon libdaemon;
propagatedBuildInputs = [ gnutls ];
configureFlags = ''
${if documentation then "--enable-gtk-doc" else "--disable-gtk-doc"}
${edf gtkWidgets "inftextgtk"}
${edf gtkWidgets "infgtk"}
${edf daemon "infinoted"}
${edf daemon "libdaemon"}
${edf avahiSupport "avahi"}
'';
passthru = {
inherit version;
};
meta = {
homepage = http://gobby.0x539.de/;
description = "An implementation of the Infinote protocol written in GObject-based C";
license = stdenv.lib.licenses.lgpl2Plus;
maintainers = [ stdenv.lib.maintainers.phreedom ];
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}

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;