diff --git a/nixos/modules/services/hardware/upower.nix b/nixos/modules/services/hardware/upower.nix index a202d82f646..0b6a101efa0 100644 --- a/nixos/modules/services/hardware/upower.nix +++ b/nixos/modules/services/hardware/upower.nix @@ -4,6 +4,9 @@ with lib; +let + cfg = config.services.upower; +in { ###### interface @@ -21,6 +24,15 @@ with lib; ''; }; + package = mkOption { + type = types.package; + default = pkgs.upower; + example = lib.literalExample "pkgs.upower"; + description = '' + Which upower package to use. + ''; + }; + }; }; @@ -28,13 +40,13 @@ with lib; ###### implementation - config = mkIf config.services.upower.enable { + config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.upower ]; + environment.systemPackages = [ cfg.package ]; - services.dbus.packages = [ pkgs.upower ]; + services.dbus.packages = [ cfg.package ]; - services.udev.packages = [ pkgs.upower ]; + services.udev.packages = [ cfg.package ]; systemd.services.upower = { description = "Power Management Daemon"; @@ -42,7 +54,7 @@ with lib; serviceConfig = { Type = "dbus"; BusName = "org.freedesktop.UPower"; - ExecStart = "@${pkgs.upower}/libexec/upowerd upowerd"; + ExecStart = "@${cfg.package}/libexec/upowerd upowerd"; }; }; diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 63f39ec0d3a..4398a97ff47 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -70,6 +70,7 @@ in { services.telepathy.enable = mkDefault true; networking.networkmanager.enable = true; services.upower.enable = config.powerManagement.enable; + services.upower.package = gnome3.upower; fonts.fonts = [ pkgs.dejavu_fonts ]; diff --git a/pkgs/desktops/gnome-3/3.10/default.nix b/pkgs/desktops/gnome-3/3.10/default.nix index 2cb28e0c307..b58bf7ef1d3 100644 --- a/pkgs/desktops/gnome-3/3.10/default.nix +++ b/pkgs/desktops/gnome-3/3.10/default.nix @@ -1,7 +1,7 @@ { callPackage, self, pkgs }: rec { - inherit (pkgs) glib gtk2 gtk3 gnome2; + inherit (pkgs) glib gtk2 gtk3 gnome2 upower; gtk = gtk3; # just to be sure libcanberra = pkgs.libcanberra_gtk3; # just to be sure inherit (pkgs.gnome2) ORBit2; diff --git a/pkgs/desktops/gnome-3/3.12/default.nix b/pkgs/desktops/gnome-3/3.12/default.nix index e5c57903da0..f1c876d3665 100644 --- a/pkgs/desktops/gnome-3/3.12/default.nix +++ b/pkgs/desktops/gnome-3/3.12/default.nix @@ -3,6 +3,7 @@ rec { inherit (pkgs) glib gtk2 gtk3 gnome2; gnome3 = pkgs.gnome3_12; + upower = pkgs.upower_99; gtk = gtk3; # just to be sure libcanberra = pkgs.libcanberra_gtk3; # just to be sure inherit (pkgs.gnome2) ORBit2; diff --git a/pkgs/os-specific/linux/upower/0.99.nix b/pkgs/os-specific/linux/upower/0.99.nix new file mode 100644 index 00000000000..c42fea16d35 --- /dev/null +++ b/pkgs/os-specific/linux/upower/0.99.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchurl, pkgconfig, glib, dbus, dbus_glib, dbus_tools, polkit +, intltool, libxslt, docbook_xsl, udev, libusb1, pmutils +, useSystemd ? true, systemd, gobjectIntrospection +}: + +assert stdenv.isLinux; + +stdenv.mkDerivation rec { + name = "upower-0.99.0"; + + src = fetchurl { + url = "http://upower.freedesktop.org/releases/${name}.tar.xz"; + sha256 = "189rd8j5czy4fs7imxvr38icjh9vlgdz6ki2h08v530h96clndaz"; + }; + + buildInputs = + [ dbus_glib polkit intltool libxslt docbook_xsl udev libusb1 gobjectIntrospection ] + ++ stdenv.lib.optional useSystemd systemd; + + nativeBuildInputs = [ pkgconfig ]; + + preConfigure = + '' + substituteInPlace src/linux/up-backend.c \ + --replace /usr/bin/pm- ${pmutils}/bin/pm- \ + --replace /usr/sbin/pm- ${pmutils}/sbin/pm- + substituteInPlace src/notify-upower.sh \ + --replace /usr/bin/dbus-send ${dbus_tools}/bin/dbus-send + ''; + + configureFlags = + [ "--with-backend=linux" "--localstatedir=/var" + "--enable-deprecated" # needed for Xfce (Nov 2013) + ] + ++ stdenv.lib.optional useSystemd + [ "--enable-systemd" + "--with-systemdsystemunitdir=$(out)/etc/systemd/system" + "--with-systemdutildir=$(out)/lib/systemd/system-sleep" + "--with-udevrulesdir=$(out)/lib/udev/rules.d" + ]; + + NIX_CFLAGS_LINK = "-lgcc_s"; + + installFlags = "historydir=$(TMPDIR)/foo"; + + meta = { + homepage = http://upower.freedesktop.org/; + description = "A D-Bus service for power management"; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f4e0337c3b3..9d88f1ff5eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7544,6 +7544,8 @@ let upower = callPackage ../os-specific/linux/upower { }; + upower_99 = callPackage ../os-specific/linux/upower/0.99.nix { }; + upstart = callPackage ../os-specific/linux/upstart { }; usbutils = callPackage ../os-specific/linux/usbutils { };