diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 18d60504c810..1c5cef95a66b 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -10591,6 +10591,12 @@
githubId = 1699466;
name = "Michael Peyton Jones";
};
+ michaelshmitty = {
+ name = "Michael Smith";
+ email = "shmitty@protonmail.com";
+ github = "michaelshmitty";
+ githubId = 114845;
+ };
michalrus = {
email = "m@michalrus.com";
github = "michalrus";
diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md
index 8009e2337888..66bed591d48e 100644
--- a/nixos/doc/manual/release-notes/rl-2311.section.md
+++ b/nixos/doc/manual/release-notes/rl-2311.section.md
@@ -16,6 +16,8 @@
- [GoToSocial](https://gotosocial.org/), an ActivityPub social network server, written in Golang. Available as [services.gotosocial](#opt-services.gotosocial.enable).
+- [Anuko Time Tracker](https://github.com/anuko/timetracker), a simple, easy to use, open source time tracking system. Available as [services.anuko-time-tracker](#opt-services.anuko-time-tracker.enable).
+
- [sitespeed-io](https://sitespeed.io), a tool that can generate metrics (timings, diagnostics) for websites. Available as [services.sitespeed-io](#opt-services.sitespeed-io.enable).
- [Apache Guacamole](https://guacamole.apache.org/), a cross-platform, clientless remote desktop gateway. Available as [services.guacamole-server](#opt-services.guacamole-server.enable) and [services.guacamole-client](#opt-services.guacamole-client.enable) services.
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 6e8f062c1694..e728dcb3f192 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -1169,6 +1169,7 @@
./services/wayland/cage.nix
./services/web-apps/akkoma.nix
./services/web-apps/alps.nix
+ ./services/web-apps/anuko-time-tracker.nix
./services/web-apps/atlassian/confluence.nix
./services/web-apps/atlassian/crowd.nix
./services/web-apps/atlassian/jira.nix
diff --git a/nixos/modules/services/web-apps/anuko-time-tracker.nix b/nixos/modules/services/web-apps/anuko-time-tracker.nix
new file mode 100644
index 000000000000..c50a0328e34d
--- /dev/null
+++ b/nixos/modules/services/web-apps/anuko-time-tracker.nix
@@ -0,0 +1,354 @@
+{ config, pkgs, lib, ... }:
+
+let
+ cfg = config.services.anuko-time-tracker;
+ configFile = let
+ smtpPassword = if cfg.settings.email.smtpPasswordFile == null
+ then "''"
+ else "trim(file_get_contents('${cfg.settings.email.smtpPasswordFile}'))";
+
+ in pkgs.writeText "config.php" ''
+ ";
+ };
+
+ mode = lib.mkOption {
+ type = lib.types.str;
+ description = lib.mdDoc "Mail sending mode. Can be 'mail' or 'smtp'.";
+ default = "smtp";
+ };
+
+ smtpHost = lib.mkOption {
+ type = lib.types.str;
+ description = lib.mdDoc "MTA hostname.";
+ default = "localhost";
+ };
+
+ smtpPort = lib.mkOption {
+ type = lib.types.int;
+ description = lib.mdDoc "MTA port.";
+ default = 25;
+ };
+
+ smtpUser = lib.mkOption {
+ type = lib.types.str;
+ description = lib.mdDoc "MTA authentication username.";
+ default = "";
+ };
+
+ smtpAuth = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = lib.mdDoc "MTA requires authentication.";
+ };
+
+ smtpPasswordFile = lib.mkOption {
+ type = lib.types.nullOr lib.types.path;
+ default = null;
+ example = "/var/lib/anuko-time-tracker/secrets/smtp-password";
+ description = lib.mdDoc ''
+ Path to file containing the MTA authentication password.
+ '';
+ };
+
+ smtpDebug = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = lib.mdDoc "Debug mail sending.";
+ };
+ };
+
+ defaultLanguage = lib.mkOption {
+ type = lib.types.str;
+ description = lib.mdDoc ''
+ Defines Anuko Time Tracker default language. It is used on Time Tracker login page.
+ After login, a language set for user group is used.
+ Empty string means the language is defined by user browser.
+ '';
+ default = "";
+ example = "nl";
+ };
+
+ defaultCurrency = lib.mkOption {
+ type = lib.types.str;
+ description = lib.mdDoc ''
+ Defines a default currency symbol for new groups.
+ Use €, £, a more specific dollar like US$, CAD, etc.
+ '';
+ default = "$";
+ example = "€";
+ };
+
+ exportDecimalDuration = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ description = lib.mdDoc ''
+ Defines whether time duration values are decimal in CSV and XML data
+ exports (1.25 vs 1:15).
+ '';
+ };
+
+ reportFooter = lib.mkOption {
+ type = lib.types.bool;
+ default = true;
+ description = lib.mdDoc "Defines whether to use a footer on reports.";
+ };
+ };
+ };
+
+ config = lib.mkIf cfg.enable {
+
+ assertions = [
+ {
+ assertion = cfg.database.createLocally -> cfg.database.passwordFile == null;
+ message = ''
+ cannot be specified if
+ is set to true.
+ '';
+ }
+ {
+ assertion = cfg.settings.email.smtpAuth -> (cfg.settings.email.smtpPasswordFile != null);
+ message = ''
+ needs to be set if
+ is enabled.
+ '';
+ }
+ ];
+
+ services.phpfpm = {
+ pools.anuko-time-tracker = {
+ inherit (cfg) user;
+ group = config.services.nginx.group;
+ settings = {
+ "listen.owner" = config.services.nginx.user;
+ "listen.group" = config.services.nginx.group;
+ } // cfg.poolConfig;
+ };
+ };
+
+ services.nginx = lib.mkIf (cfg.virtualHost != null) {
+ enable = true;
+ virtualHosts = {
+ "${cfg.virtualHost}" = {
+ root = lib.mkForce "${package}";
+ locations."/".index = "index.php";
+ locations."~ [^/]\\.php(/|$)" = {
+ extraConfig = ''
+ fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+ fastcgi_pass unix:${config.services.phpfpm.pools.anuko-time-tracker.socket};
+ '';
+ };
+ };
+ };
+ };
+
+ services.mysql = lib.mkIf cfg.database.createLocally {
+ enable = lib.mkDefault true;
+ package = lib.mkDefault pkgs.mariadb;
+ ensureDatabases = [ cfg.database.name ];
+ ensureUsers = [{
+ name = cfg.database.user;
+ ensurePermissions = {
+ "${cfg.database.name}.*" = "ALL PRIVILEGES";
+ };
+ }];
+ };
+
+ systemd = {
+ services = {
+ anuko-time-tracker-setup-database = lib.mkIf cfg.database.createLocally {
+ description = "Set up Anuko Time Tracker database";
+ serviceConfig = {
+ Type = "oneshot";
+ RemainAfterExit = true;
+ };
+ wantedBy = [ "phpfpm-anuko-time-tracker.service" ];
+ after = [ "mysql.service" ];
+ script =
+ let
+ mysql = "${config.services.mysql.package}/bin/mysql";
+ in
+ ''
+ if [ ! -f ${cfg.dataDir}/.dbexists ]; then
+ # Load database schema provided with package
+ ${mysql} ${cfg.database.name} < ${cfg.package}/mysql.sql
+
+ touch ${cfg.dataDir}/.dbexists
+ fi
+ '';
+ };
+ };
+ tmpfiles.rules = [
+ "d ${cfg.dataDir} 0750 ${cfg.user} ${config.services.nginx.group} -"
+ "d ${cfg.dataDir}/templates_c 0750 ${cfg.user} ${config.services.nginx.group} -"
+ ];
+ };
+
+ users.users."${cfg.user}" = {
+ isSystemUser = true;
+ group = config.services.nginx.group;
+ };
+ };
+
+ meta.maintainers = with lib.maintainers; [ michaelshmitty ];
+}
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index e1ecda9af42c..0788394eb39e 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -107,6 +107,7 @@ in {
allTerminfo = handleTest ./all-terminfo.nix {};
alps = handleTest ./alps.nix {};
amazon-init-shell = handleTest ./amazon-init-shell.nix {};
+ anuko-time-tracker = handleTest ./anuko-time-tracker.nix {};
apcupsd = handleTest ./apcupsd.nix {};
apfs = runTest ./apfs.nix;
apparmor = handleTest ./apparmor.nix {};
diff --git a/nixos/tests/anuko-time-tracker.nix b/nixos/tests/anuko-time-tracker.nix
new file mode 100644
index 000000000000..18c3bf5cf695
--- /dev/null
+++ b/nixos/tests/anuko-time-tracker.nix
@@ -0,0 +1,17 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+ name = "anuko-time-tracker";
+ meta = {
+ maintainers = with pkgs.lib.maintainers; [ michaelshmitty ];
+ };
+ nodes = {
+ machine = {
+ services.anuko-time-tracker.enable = true;
+ };
+ };
+ testScript = ''
+ start_all()
+ machine.wait_for_unit("phpfpm-anuko-time-tracker")
+ machine.wait_for_open_port(80);
+ machine.wait_until_succeeds("curl -s --fail -L http://localhost/time.php | grep 'Anuko Time Tracker'")
+ '';
+})
diff --git a/pkgs/servers/web-apps/anuko-time-tracker/default.nix b/pkgs/servers/web-apps/anuko-time-tracker/default.nix
new file mode 100644
index 000000000000..583f2db81938
--- /dev/null
+++ b/pkgs/servers/web-apps/anuko-time-tracker/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, stdenvNoCC
+, fetchFromGitHub
+, nixosTests
+, php
+}:
+
+stdenvNoCC.mkDerivation rec {
+ pname = "anuko-time-tracker";
+ version = "1.22.19.5806";
+
+ # Project commits directly into master and has no release schedule.
+ # Fortunately the current version is defined in the 'APP_VERSION' constant in
+ # /initialize.php so we use its value and set the rev to the commit sha of when the
+ # constant was last updated.
+ src = fetchFromGitHub {
+ owner = "anuko";
+ repo = "timetracker";
+ rev = "43a19fcb51a21f6e3169084ac81308a6ef751e63";
+ hash = "sha256-ZRF9FFbntYY01JflCXkYZyXfyu/x7LNdyOB94UkVFR0=";
+ };
+
+ # There's nothing to build.
+ dontBuild = true;
+
+ installPhase = ''
+ mkdir $out/
+ cp -R ./* $out
+ '';
+
+ passthru.tests = {
+ inherit (nixosTests) anuko-time-tracker;
+ };
+
+ meta = {
+ description = "Simple, easy to use, open source time tracking system";
+ license = lib.licenses.sspl;
+ homepage = "https://github.com/anuko/timetracker/";
+ platforms = php.meta.platforms;
+ maintainers = with lib.maintainers; [ michaelshmitty ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 75187b4baaa7..a4e05f6a4dce 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -25458,6 +25458,8 @@ with pkgs;
alps = callPackage ../servers/alps { };
+ anuko-time-tracker = callPackage ../servers/web-apps/anuko-time-tracker { };
+
apache-directory-server = callPackage ../servers/ldap/apache-directory-server { };
apacheHttpd_2_4 = callPackage ../servers/http/apache-httpd/2.4.nix {