nixpkgs/modules/services/system/uptimed.nix
Eelco Dolstra 573877c1ac * Use boot.kernelModules everywhere instead of explicit calls to
modprobe.
* Move the implementation of boot.kernelModules from the udev job to
  the activation script.  This prevents races with the udev job.
* Drop references to the "capability" kernel module, which no longer
  exists.

svn path=/nixos/trunk/; revision=33208
2012-03-17 17:26:17 +00:00

69 lines
1.1 KiB
Nix

{pkgs, config, ...}:
let
inherit (pkgs.lib) mkOption mkIf singleton;
inherit (pkgs) uptimed;
stateDir = "/var/spool/uptimed";
uptimedUser = "uptimed";
in
{
###### interface
options = {
services.uptimed = {
enable = mkOption {
default = false;
description = ''
Uptimed allows you to track your highest uptimes.
'';
};
};
};
###### implementation
config = mkIf config.services.uptimed.enable {
environment.systemPackages = [ uptimed ];
users.extraUsers = singleton
{ name = uptimedUser;
uid = config.ids.uids.uptimed;
description = "Uptimed daemon user";
home = stateDir;
};
jobs.uptimed =
{ description = "Uptimed daemon";
startOn = "startup";
preStart =
''
mkdir -m 0755 -p ${stateDir}
chown ${uptimedUser} ${stateDir}
if ! test -f ${stateDir}/bootid ; then
${uptimed}/sbin/uptimed -b
fi
'';
exec = "${uptimed}/sbin/uptimed";
};
};
}