* added uptimed module
svn path=/nixos/trunk/; revision=17173
This commit is contained in:
parent
10e9705a86
commit
9587192c68
@ -47,6 +47,7 @@ in
|
|||||||
gnunetd = 17;
|
gnunetd = 17;
|
||||||
pulseaudio = 22; # must match `pulseaudio' GID
|
pulseaudio = 22; # must match `pulseaudio' GID
|
||||||
gpsd = 23;
|
gpsd = 23;
|
||||||
|
uptimed = 24;
|
||||||
|
|
||||||
nixbld = 30000; # start of range of uids
|
nixbld = 30000; # start of range of uids
|
||||||
nobody = 65534;
|
nobody = 65534;
|
||||||
|
@ -79,6 +79,7 @@
|
|||||||
./services/scheduling/fcron.nix
|
./services/scheduling/fcron.nix
|
||||||
./services/system/dbus.nix
|
./services/system/dbus.nix
|
||||||
./services/system/nscd.nix
|
./services/system/nscd.nix
|
||||||
|
./services/system/uptimed.nix
|
||||||
./services/ttys/gpm.nix
|
./services/ttys/gpm.nix
|
||||||
./services/ttys/mingetty.nix
|
./services/ttys/mingetty.nix
|
||||||
./services/web-servers/apache-httpd/default.nix
|
./services/web-servers/apache-httpd/default.nix
|
||||||
|
81
modules/services/system/uptimed.nix
Normal file
81
modules/services/system/uptimed.nix
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
{pkgs, config, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
inherit (pkgs.lib) mkOption mkIf singleton;
|
||||||
|
|
||||||
|
inherit (pkgs) uptimed;
|
||||||
|
|
||||||
|
stateDir = "/var/spool/uptimed";
|
||||||
|
|
||||||
|
uptimedUser = "uptimed";
|
||||||
|
|
||||||
|
modprobe = config.system.sbin.modprobe;
|
||||||
|
|
||||||
|
uptimedFlags = "";
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
###### interface
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.uptimed = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Uptimed allows you to track your highest uptimes.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
###### implementation
|
||||||
|
|
||||||
|
config = mkIf config.services.uptimed.enable {
|
||||||
|
|
||||||
|
users.extraUsers = singleton
|
||||||
|
{ name = uptimedUser;
|
||||||
|
uid = config.ids.uids.uptimed;
|
||||||
|
description = "Uptimed daemon user";
|
||||||
|
home = stateDir;
|
||||||
|
};
|
||||||
|
|
||||||
|
jobs = singleton {
|
||||||
|
|
||||||
|
name = "uptimed";
|
||||||
|
|
||||||
|
job = ''
|
||||||
|
description "Uptimed daemon"
|
||||||
|
|
||||||
|
start on startup
|
||||||
|
stop on shutdown
|
||||||
|
|
||||||
|
start script
|
||||||
|
|
||||||
|
mkdir -m 0755 -p ${stateDir}
|
||||||
|
chown ${uptimedUser} ${stateDir}
|
||||||
|
|
||||||
|
# Needed to run uptimed as an unprivileged user.
|
||||||
|
${modprobe}/sbin/modprobe capability || true
|
||||||
|
|
||||||
|
if ! test -f ${stateDir}/bootid ; then
|
||||||
|
${uptimed}/sbin/uptimed -b
|
||||||
|
fi
|
||||||
|
|
||||||
|
end script
|
||||||
|
|
||||||
|
respawn ${uptimed}/sbin/uptimed ${uptimedFlags}
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user