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 {
type = types.package;
default = pkgs.libinfinity.override { daemon = true; };
defaultText = "pkgs.libinfinity.override { daemon = true; }";
default = pkgs.libinfinity;
defaultText = "pkgs.libinfinity";
description = ''
Package providing infinoted
'';
@ -119,7 +119,7 @@ in {
users.groups = optional (cfg.group == "infinoted")
{ name = "infinoted";
};
systemd.services.infinoted =
{ description = "Gobby Dedicated Server";
@ -129,7 +129,7 @@ in {
serviceConfig = {
Type = "simple";
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;
Group = cfg.group;
PermissionsStartOnly = true;

View file

@ -1,52 +1,53 @@
{ gtkWidgets ? false # build GTK widgets for libinfinity
, daemon ? false # build infinote daemon
, documentation ? false # build documentation
, avahiSupport ? false # build support for Avahi in libinfinity
, 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 }:
assert avahiSupport -> avahi != null;
assert gtkWidgets -> gtk3 != null;
let
edf = flag: feature: (if flag then "--with-" else "--without-") + feature;
optional = cond: elem: assert cond -> elem != null; if cond then [elem] else [];
mkFlag = flag: feature: (if flag then "--with-" else "--without-") + feature;
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}";
version = "0.7.1";
src = fetchurl {
url = "http://releases.0x539.de/libinfinity/${name}.tar.gz";
sha256 = "1jw2fhrcbpyz99bij07iyhy9ffyqdn87vl8cb1qz897y3f2f0vk2";
outputs = [ "bin" "out" "dev" "man" "devdoc" ];
nativeBuildInputs = [ pkgconfig gtk-doc docbook_xsl docbook_xml_dtd_412 gobjectIntrospection ];
buildInputs = [ glib libxml2 gsasl libidn gss libintl libdaemon ]
++ 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;
};
};
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;
};
}
in self

View file

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