1{ lib, stdenv, fetchurl, gawk }:
2
3let version = "2.0";
4in
5 stdenv.mkDerivation {
6 pname = "hibernate";
7 inherit version;
8 src = fetchurl {
9 url = "http://tuxonice.nigelcunningham.com.au/files/hibernate-script-${version}.tar.gz";
10 sha256 = "0ib5bac3spbcwmhf8f9apjbll8x7fgqj4k1s5q3srijh793rfifh";
11 };
12
13 patches = [ ./install.patch ./gen-manpages.patch ./hibernate.patch ];
14
15 buildInputs = [ gawk ];
16
17 installPhase = ''
18 # FIXME: Storing config files under `$out/etc' is not very useful.
19
20 substituteInPlace "hibernate.sh" --replace \
21 'SWSUSP_D="/etc/hibernate"' "SWSUSP_D=\"$out/etc/hibernate\""
22
23 # Remove all references to `/bin' and `/sbin'.
24 for i in scriptlets.d/*
25 do
26 substituteInPlace "$i" --replace "/bin/" "" --replace "/sbin/" ""
27 done
28
29 PREFIX="$out" CONFIG_PREFIX="$out" ./install.sh
30
31 ln -s "$out/share/hibernate/scriptlets.d" "$out/etc/hibernate"
32 '';
33
34 meta = {
35 description = "The `hibernate' script for swsusp and Tux-on-Ice";
36 longDescription = ''
37 This package provides the `hibernate' script, a command-line utility
38 that saves the computer's state to disk and switches it off, turning
39 it into "hibernation". It works both with Linux swsusp and Tux-on-Ice.
40 '';
41
42 license = lib.licenses.gpl2Plus;
43 homepage = "http://www.tuxonice.net/";
44 platforms = lib.platforms.linux;
45 };
46 }