1 { config, lib, pkgs, ... }:
6 cfg = config.services.uptimed;
7 stateDir = "/var/lib/uptimed";
16 Enable `uptimed`, allowing you to track
23 config = mkIf cfg.enable {
25 environment.systemPackages = [ pkgs.uptimed ];
27 users.users.uptimed = {
28 description = "Uptimed daemon user";
30 uid = config.ids.uids.uptimed;
33 users.groups.uptimed = {};
35 systemd.services.uptimed = {
36 unitConfig.Documentation = "man:uptimed(8) man:uprecords(1)";
37 description = "uptimed service";
38 wantedBy = [ "multi-user.target" ];
41 Restart = "on-failure";
44 IOSchedulingClass = "idle";
46 PrivateNetwork = "yes";
47 NoNewPrivileges = "yes";
48 StateDirectory = [ "uptimed" ];
49 InaccessibleDirectories = "/home";
50 ExecStart = "${pkgs.uptimed}/sbin/uptimed -f -p ${stateDir}/pid";
54 if ! test -f ${stateDir}/bootid ; then
55 ${pkgs.uptimed}/sbin/uptimed -b