8 cfg = config.services.uptimed;
9 stateDir = "/var/lib/uptimed";
14 enable = lib.mkOption {
15 type = lib.types.bool;
18 Enable `uptimed`, allowing you to track
25 config = lib.mkIf cfg.enable {
27 environment.systemPackages = [ pkgs.uptimed ];
29 users.users.uptimed = {
30 description = "Uptimed daemon user";
32 uid = config.ids.uids.uptimed;
35 users.groups.uptimed = { };
37 systemd.services.uptimed = {
38 unitConfig.Documentation = "man:uptimed(8) man:uprecords(1)";
39 description = "uptimed service";
40 wantedBy = [ "multi-user.target" ];
43 Restart = "on-failure";
46 IOSchedulingClass = "idle";
48 PrivateNetwork = "yes";
49 NoNewPrivileges = "yes";
50 StateDirectory = [ "uptimed" ];
51 InaccessibleDirectories = "/home";
52 ExecStart = "${pkgs.uptimed}/sbin/uptimed -f -p ${stateDir}/pid";
56 if ! test -f ${stateDir}/bootid ; then
57 ${pkgs.uptimed}/sbin/uptimed -b