Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
fix: make the opengym-mcp NixOS module actually work
gerrydoroae6a4efd8287
diff --git a/docs/NIX.md b/docs/NIX.mdindex 8e9be9ab1..0e680742c 100644--- a/docs/NIX.md+++ b/docs/NIX.md@@ -406,6 +406,7 @@ for other modules to consume — setting them yourself is an error.| Option | Type | Default | Description || --- | --- | --- | --- || `mcp.enable` | `bool` | `false` | Run the read-only MCP server as a systemd service (reads the same `dataDir`). Off unless you point an LLM client at it. |+| `mcp.uid` | `string \| null` | `null` | The openGym user ID (from `db.json` `"users"[].id`) the MCP server serves. Leave unset to auto-pick when exactly one user exists; with multiple users it must be set (the server otherwise exits listing them). |### Option → environment mappingdiff --git a/nix/mcp.nix b/nix/mcp.nixindex b3a03348b..7590a3d0c 100644--- a/nix/mcp.nix+++ b/nix/mcp.nix@@ -12,6 +12,9 @@ buildNpmPackage rec {src = ./../mcp;+ # The MCP server reads shared domain helpers from the sibling frontend/src/lib; include them.+ frontendSrc = ./../frontend;+nodejs = nodejs_22;npmDepsHash = "sha256-15xl0gNcmAdcPp/cwlJNIAmNqoRWM1dsMwwAloNZeu0=";@@ -26,6 +29,12 @@ buildNpmPackage rec {cp -r node_modules $out/lib/opengym-mcp/cp -r src $out/lib/opengym-mcp/+ # The MCP server imports shared training/domain helpers from ../../frontend/src/lib+ # (history, exercises, muscles, onerm, progression, workout-model, format, …). They are+ # resolved relative to $out/lib/opengym-mcp/src, so they must sit at $out/lib/frontend/src/lib.+ mkdir -p $out/lib/frontend/src+ cp -r $frontendSrc/src/lib $out/lib/frontend/src/lib+mkdir -p $out/binmakeWrapper ${nodejs_22}/bin/node $out/bin/opengym-mcp \--add-flags "$out/lib/opengym-mcp/src/index.js"diff --git a/nix/opengym.nix b/nix/opengym.nixindex 1f7323fcb..8d91e583c 100644--- a/nix/opengym.nix+++ b/nix/opengym.nix@@ -233,6 +233,17 @@ inmcp = {enable = lib.mkEnableOption "openGym MCP server (stdio bridge for LLM clients)";++ uid = lib.mkOption {+ type = lib.types.nullOr lib.types.str;+ default = null;+ description = ''+ The openGym user ID (from db.json "users"[].id) the MCP server serves.+ When null, the server auto-picks when exactly one user exists; with multiple+ users this option must be set. Use the `environment` escape hatch for the+ same effect.+ '';+ };};};@@ -330,7 +341,10 @@ inafter = [ "network.target" ];wantedBy = [ "multi-user.target" ];environment = {- DATA_DIR = cfg.dataDir;+ # The MCP server reads OPENGYM_DATA (not DATA_DIR) to locate the data files.+ OPENGYM_DATA = cfg.dataDir;+ } // lib.optionalAttrs (cfg.mcp.uid != null) {+ OPENGYM_UID = cfg.mcp.uid;};serviceConfig = lib.mkMerge [{