1{ stdenv, fetchurl, coreutils, gnugrep, utillinux, kmod
2, procps, kbd, dbus_tools }:
3
4let
5
6 binPath = stdenv.lib.makeBinPath
7 [ coreutils gnugrep utillinux kmod procps kbd dbus_tools ];
8
9 sbinPath = stdenv.lib.makeSearchPathOutput "bin" "sbin"
10 [ procps ];
11
12in
13
14stdenv.mkDerivation rec {
15 name = "pm-utils-1.4.1";
16
17 src = fetchurl {
18 url = "http://pm-utils.freedesktop.org/releases/${name}.tar.gz";
19 sha256 = "02qc6zaf7ams6qcc470fwb6jvr4abv3lrlx16clqpn36501rkn4f";
20 };
21
22 configureFlags = "--sysconfdir=/etc";
23
24 preConfigure =
25 ''
26 # Install the manpages (xmlto isn't really needed).
27 substituteInPlace man/Makefile.in --replace '@HAVE_XMLTO_TRUE@' ""
28
29 # Set the PATH properly.
30 substituteInPlace pm/pm-functions.in --replace '/sbin:/usr/sbin:/bin:/usr/bin' '$PATH:${binPath}:${sbinPath}'
31
32 substituteInPlace src/pm-action.in --replace 'tr ' '${coreutils}/bin/tr '
33
34 substituteInPlace pm/sleep.d/00logging --replace /bin/uname "$(type -P uname)"
35
36 substituteInPlace pm/sleep.d/90clock --replace /sbin/hwclock hwclock
37 '';
38
39 postInstall =
40 ''
41 # Remove some hooks that have doubtful usefulness. See
42 # http://zinc.canonical.com/~cking/power-benchmarking/pm-utils-results/results.txt.
43 # In particular, journal-commit breaks things if you have
44 # read-only bind mounts, since it ends up remounting the
45 # underlying filesystem read-only.
46 rm $out/lib/pm-utils/power.d/{journal-commit,readahead}
47 '';
48
49 meta = {
50 homepage = https://pm-utils.freedesktop.org/wiki/;
51 description = "A small collection of scripts that handle suspend and resume on behalf of HAL";
52 license = stdenv.lib.licenses.gpl2;
53 platforms = stdenv.lib.platforms.linux;
54 };
55}