about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--maintainers/maintainer-list.nix12
-rw-r--r--nixos/doc/manual/release-notes/rl-2405.section.md2
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/workout-tracker.nix83
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/workout-tracker.nix29
-rw-r--r--pkgs/applications/misc/go-org/default.nix2
-rw-r--r--pkgs/by-name/gl/glas/package.nix2
-rw-r--r--pkgs/by-name/wo/workout-tracker/package.nix32
-rw-r--r--pkgs/tools/networking/xh/default.nix2
10 files changed, 157 insertions, 9 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 025a3b9bfeee7..141c8cf6e9baf 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -2544,6 +2544,12 @@
     githubId = 34919100;
     name = "Brendan Hall";
   };
+  bhankas = {
+    email = "payas@relekar.org";
+    github = "bhankas";
+    githubId = 24254289;
+    name = "Payas Relekar";
+  };
   bhipple = {
     email = "bhipple@protonmail.com";
     github = "bhipple";
@@ -15116,12 +15122,6 @@
     githubId = 116740;
     name = "Paweł Pacana";
   };
-  payas = {
-    email = "relekarpayas@gmail.com";
-    github = "bhankas";
-    githubId = 24254289;
-    name = "Payas Relekar";
-  };
   pb- = {
     email = "pbaecher@gmail.com";
     github = "pb-";
diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md
index b736d71288c0b..d9e066ffad619 100644
--- a/nixos/doc/manual/release-notes/rl-2405.section.md
+++ b/nixos/doc/manual/release-notes/rl-2405.section.md
@@ -95,6 +95,8 @@ Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` for Pi
 
 - [hebbot](https://github.com/haecker-felix/hebbot), a Matrix bot to generate "This Week in X" like blog posts. Available as [services.hebbot](#opt-services.hebbot.enable).
 
+- [Workout-tracker](https://github.com/jovandeginste/workout-tracker), a workout tracking web application for personal use.
+
 - [Python Matter Server](https://github.com/home-assistant-libs/python-matter-server), a
   Matter Controller Server exposing websocket connections for use with other services, notably Home Assistant.
   Available as [services.matter-server](#opt-services.matter-server.enable)
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 0c8e66c33174a..0a15360f6ea50 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -800,6 +800,7 @@
   ./services/misc/tzupdate.nix
   ./services/misc/uhub.nix
   ./services/misc/weechat.nix
+  ./services/misc/workout-tracker.nix
   ./services/misc/xmr-stak.nix
   ./services/misc/xmrig.nix
   ./services/misc/zoneminder.nix
diff --git a/nixos/modules/services/misc/workout-tracker.nix b/nixos/modules/services/misc/workout-tracker.nix
new file mode 100644
index 0000000000000..13555504be302
--- /dev/null
+++ b/nixos/modules/services/misc/workout-tracker.nix
@@ -0,0 +1,83 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}:
+
+let
+  inherit (lib) types;
+  cfg = config.services.workout-tracker;
+  stateDir = "workout-tracker";
+in
+
+{
+  options = {
+    services.workout-tracker = {
+      enable = lib.mkEnableOption "workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities";
+
+      package = lib.mkPackageOption pkgs "workout-tracker" { };
+
+      address = lib.mkOption {
+        type = types.str;
+        default = "127.0.0.1";
+        description = "Web interface address.";
+      };
+
+      port = lib.mkOption {
+        type = types.port;
+        default = 8080;
+        description = "Web interface port.";
+      };
+
+      environmentFile = lib.mkOption {
+        type = types.nullOr types.path;
+        default = null;
+        example = "/run/keys/workout-tracker.env";
+        description = ''
+          An environment file as defined in {manpage}`systemd.exec(5)`.
+
+          Secrets like `WT_JWT_ENCRYPTION_KEY` may be passed to the service without adding them
+          to the world-readable Nix store.
+        '';
+      };
+
+      settings = lib.mkOption {
+        type = types.attrsOf types.str;
+
+        default = { };
+        description = ''
+          Extra config options.
+        '';
+        example = {
+          WT_LOGGING = "true";
+          WT_DEBUG = "false";
+          WT_DATABASE_DRIVER = "sqlite";
+          WT_DSN = "./database.db";
+        };
+      };
+    };
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.services.workout-tracker = {
+      description = "A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities";
+      wantedBy = [ "multi-user.target" ];
+      environment = {
+        WT_BIND = "${cfg.address}:${toString cfg.port}";
+        WT_DATABASE_DRIVER = "sqlite";
+        WT_DSN = "./database.db";
+      } // cfg.settings;
+      serviceConfig = {
+        ExecStart = lib.getExe cfg.package;
+        DynamicUser = true;
+        StateDirectory = stateDir;
+        WorkingDirectory = "%S/${stateDir}";
+        Restart = "always";
+        EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
+      };
+    };
+  };
+
+  meta.maintainers = with lib.maintainers; [ bhankas ];
+}
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index f7ad6c16f5875..6a6ef1f6f38b2 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -992,6 +992,7 @@ in {
   wireguard = handleTest ./wireguard {};
   without-nix = handleTest ./without-nix.nix {};
   wmderland = handleTest ./wmderland.nix {};
+  workout-tracker = handleTest ./workout-tracker.nix {};
   wpa_supplicant = handleTest ./wpa_supplicant.nix {};
   wordpress = handleTest ./wordpress.nix {};
   wrappers = handleTest ./wrappers.nix {};
diff --git a/nixos/tests/workout-tracker.nix b/nixos/tests/workout-tracker.nix
new file mode 100644
index 0000000000000..1ad509edf2d4c
--- /dev/null
+++ b/nixos/tests/workout-tracker.nix
@@ -0,0 +1,29 @@
+import ./make-test-python.nix (
+  { lib, pkgs, ... }:
+
+  {
+    name = "workout-tracker";
+
+    meta.maintainers = with lib.maintainers; [ bhankas ];
+
+    nodes.machine =
+      { config, ... }:
+      {
+        virtualisation.memorySize = 2048;
+
+        services.workout-tracker.enable = true;
+      };
+
+    testScript = ''
+      start_all()
+      machine.wait_for_unit("workout-tracker.service")
+      # wait for workout-tracker to fully come up
+
+      with subtest("workout-tracker service starts"):
+          machine.wait_until_succeeds(
+              "curl -sSfL http://localhost:8080/ > /dev/null",
+              timeout=30
+          )
+    '';
+  }
+)
diff --git a/pkgs/applications/misc/go-org/default.nix b/pkgs/applications/misc/go-org/default.nix
index 8aa5a3be717b4..4b0a2a9c41a7b 100644
--- a/pkgs/applications/misc/go-org/default.nix
+++ b/pkgs/applications/misc/go-org/default.nix
@@ -21,7 +21,7 @@ buildGoModule rec {
     description = "Org-mode parser and static site generator in go";
     homepage = "https://niklasfasching.github.io/go-org";
     license = licenses.mit;
-    maintainers = with maintainers; [ payas ];
+    maintainers = with maintainers; [ bhankas ];
     mainProgram = "go-org";
   };
 }
diff --git a/pkgs/by-name/gl/glas/package.nix b/pkgs/by-name/gl/glas/package.nix
index 40a0d7f556c83..ef9390bc04c09 100644
--- a/pkgs/by-name/gl/glas/package.nix
+++ b/pkgs/by-name/gl/glas/package.nix
@@ -31,6 +31,6 @@ rustPlatform.buildRustPackage rec {
       mit
     ];
     mainProgram = "glas";
-    maintainers = with lib.maintainers; [ payas ];
+    maintainers = with lib.maintainers; [ bhankas ];
   };
 }
diff --git a/pkgs/by-name/wo/workout-tracker/package.nix b/pkgs/by-name/wo/workout-tracker/package.nix
new file mode 100644
index 0000000000000..43738d4358b2a
--- /dev/null
+++ b/pkgs/by-name/wo/workout-tracker/package.nix
@@ -0,0 +1,32 @@
+{
+  lib,
+  buildGoModule,
+  fetchFromGitHub,
+  nix-update-script,
+  ...
+}:
+
+buildGoModule rec {
+  pname = "workout-tracker";
+  version = "0.10.5";
+
+  src = fetchFromGitHub {
+    owner = "jovandeginste";
+    repo = "workout-tracker";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-ekGaNHysY0lXbB5w6AycnLR9/4dqUp0busCcPPvzSVI=";
+  };
+
+  vendorHash = null;
+
+  passthru.updateScript = nix-update-script { };
+
+  meta = {
+    changelog = "https://github.com/jovandeginste/workout-tracker/releases/tag/v${version}";
+    description = "A workout tracking web application for personal use";
+    homepage = "https://github.com/jovandeginste/workout-tracker";
+    license = lib.licenses.mit;
+    mainProgram = "workout-tracker";
+    maintainers = with lib.maintainers; [ bhankas ];
+  };
+}
diff --git a/pkgs/tools/networking/xh/default.nix b/pkgs/tools/networking/xh/default.nix
index a2cbf816fab7d..826987af508a1 100644
--- a/pkgs/tools/networking/xh/default.nix
+++ b/pkgs/tools/networking/xh/default.nix
@@ -59,6 +59,6 @@ rustPlatform.buildRustPackage rec {
     homepage = "https://github.com/ducaale/xh";
     changelog = "https://github.com/ducaale/xh/blob/v${version}/CHANGELOG.md";
     license = licenses.mit;
-    maintainers = with maintainers; [ figsoda payas ];
+    maintainers = with maintainers; [ figsoda bhankas ];
   };
 }