Unverified Commit 04698ee1 authored by Matt Sturgeon's avatar Matt Sturgeon Committed by GitHub
Browse files

nixos/timekpr: init at 0.5.8 (#419487)

parents 6f1c0bf5 33dfc47d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -152,3 +152,16 @@ original files are by default stored in `/var/lib/nixos`.
Userborn implements immutable users by re-mounting the password files
read-only. This means that unlike when using the Perl script, trying to add a
new user (e.g. via `useradd`) will fail right away.

## Restrict usage time {#sec-restrict-usage-time}

[Timekpr-nExT](https://mjasnik.gitlab.io/timekpr-next/) is a screen time managing application that helps optimizing time spent at computer for your subordinates, children or even for yourself.

You can enable it via:

```nix
{ services.timekpr.enable = true; }
```

This will install the `timekpr` package and start the `timekpr` service.
You can then use the `timekpra` application to configure time limits for users.
+3 −0
Original line number Diff line number Diff line
@@ -338,6 +338,9 @@
  "sec-userborn": [
    "index.html#sec-userborn"
  ],
  "sec-restrict-usage-time": [
    "index.html#sec-restrict-usage-time"
  ],
  "ch-file-systems": [
    "index.html#ch-file-systems"
  ],
+2 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@

- [mautrix-discord](https://github.com/mautrix/discord), a Matrix-Discord puppeting/relay bridge. Available as [services.mautrix-discord](#opt-services.mautrix-discord.enable).

- [Timekpr-nExT](https://mjasnik.gitlab.io/timekpr-next/), a time managing application that helps optimizing time spent at computer for your subordinates, children or even for yourself. Available as [](#opt-services.timekpr.enable).

- [SuiteNumérique Meet](https://github.com/suitenumerique/meet) is an open source alternative to Google Meet and Zoom powered by LiveKit: HD video calls, screen sharing, and chat features. Built with Django and React. Available as [services.lasuite-meet](#opt-services.lasuite-meet.enable).

- [lemurs](https://github.com/coastalwhite/lemurs), a customizable TUI display/login manager. Available at [services.displayManager.lemurs](#opt-services.displayManager.lemurs.enable).
+1 −0
Original line number Diff line number Diff line
@@ -1477,6 +1477,7 @@
  ./services/security/sslmate-agent.nix
  ./services/security/step-ca.nix
  ./services/security/tang.nix
  ./services/security/timekpr.nix
  ./services/security/tor.nix
  ./services/security/torify.nix
  ./services/security/torsocks.nix
+65 −0
Original line number Diff line number Diff line
{
  pkgs,
  lib,
  config,
  ...
}:
let
  cfg = config.services.timekpr;
  targetBaseDir = "/var/lib/timekpr";
  daemonUser = "root";
  daemonGroup = "root";
in
{
  options = {
    services.timekpr = {
      package = lib.mkPackageOption pkgs "timekpr" { };
      enable = lib.mkEnableOption "Timekpr-nExT, a screen time managing application that helps optimizing time spent at computer for your subordinates, children or even for yourself";
      adminUsers = lib.mkOption {
        type = lib.types.listOf lib.types.str;
        default = [ ];
        example = [
          "alice"
          "bob"
        ];
        description = ''
          All listed users will become part of the `timekpr` group so they can manage timekpr settings without requiring sudo.
        '';
      };
    };
  };

  config = lib.mkIf cfg.enable {
    users.groups.timekpr = {
      gid = 2000;
      members = cfg.adminUsers;
    };

    environment.systemPackages = [
      # Add timekpr to system packages so that polkit can find it
      cfg.package
    ];
    services.dbus.enable = true;
    services.dbus.packages = [
      cfg.package
    ];
    environment.etc."timekpr" = {
      source = "${cfg.package}/etc/timekpr";
    };
    systemd.packages = [
      cfg.package
    ];
    systemd.services.timekpr = {
      enable = true;
      wantedBy = [ "multi-user.target" ];
    };
    security.polkit.enable = true;
    systemd.tmpfiles.rules = [
      "d ${targetBaseDir} 0755 ${daemonUser} ${daemonGroup} -"
      "d ${targetBaseDir}/config 0755 ${daemonUser} ${daemonGroup} -"
      "d ${targetBaseDir}/work 0755 ${daemonUser} ${daemonGroup} -"
    ];
  };

  meta.maintainers = [ lib.maintainers.atry ];
}
Loading