Skip to content

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.

refactor: centralize version and dataset pin in nix/version.nix

gerrydoro188a5890b449
diff --git a/docs/NIX.md b/docs/NIX.md
index 6abd1290e..918824568 100644
--- a/docs/NIX.md
+++ b/docs/NIX.md
@@ -71,6 +71,7 @@ nix/
mcp.nix buildNpmPackage → bin/opengym-mcp
media.nix fetchFromGitHub pin of the exercise dataset (build-time)
media-script.nix runtime media-fetch shell script
+ version.nix version = "1.2.11" + pinned dataset commit (single source of truth)
default.nix package-set aggregator (used by both the flake and the module)
```
diff --git a/nix/api.nix b/nix/api.nix
index b44435603..f2f9b3c96 100644
--- a/nix/api.nix
+++ b/nix/api.nix
@@ -3,11 +3,12 @@
buildNpmPackage,
nodejs_22,
makeWrapper,
+ version,
}:
buildNpmPackage rec {
pname = "opengym-api";
- version = "1.2.11";
+ inherit version;
src = ./../api;
diff --git a/nix/default.nix b/nix/default.nix
index d6245a9f0..f31d4a63c 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -3,10 +3,13 @@
callPackage ? pkgs.callPackage,
}:
+let
+ versions = import ./version.nix;
+in
{
- opengym-frontend = callPackage ./frontend.nix { };
- opengym-api = callPackage ./api.nix { };
- opengym-mcp = callPackage ./mcp.nix { };
- opengym-media = callPackage ./media.nix { };
- opengym-fetch-media = callPackage ./media-script.nix { };
+ opengym-frontend = callPackage ./frontend.nix { inherit (versions) version; };
+ opengym-api = callPackage ./api.nix { inherit (versions) version; };
+ opengym-mcp = callPackage ./mcp.nix { inherit (versions) version; };
+ opengym-media = callPackage ./media.nix { inherit (versions) datasetRev; };
+ opengym-fetch-media = callPackage ./media-script.nix { inherit (versions) datasetRev; };
}
diff --git a/nix/frontend.nix b/nix/frontend.nix
index f84a6b5d0..0b892cd61 100644
--- a/nix/frontend.nix
+++ b/nix/frontend.nix
@@ -2,11 +2,12 @@
lib,
buildNpmPackage,
nodejs_22,
+ version,
}:
buildNpmPackage rec {
pname = "opengym-frontend";
- version = "1.2.11";
+ inherit version;
src = ./../frontend;
diff --git a/nix/mcp.nix b/nix/mcp.nix
index 1431f5c8b..b3a03348b 100644
--- a/nix/mcp.nix
+++ b/nix/mcp.nix
@@ -3,11 +3,12 @@
buildNpmPackage,
nodejs_22,
makeWrapper,
+ version,
}:
buildNpmPackage rec {
pname = "opengym-mcp";
- version = "1.2.11";
+ inherit version;
src = ./../mcp;
diff --git a/nix/media-script.nix b/nix/media-script.nix
index cf27f78b4..63e610859 100644
--- a/nix/media-script.nix
+++ b/nix/media-script.nix
@@ -2,13 +2,9 @@
writeShellScriptBin,
curl,
gnutar,
+ datasetRev,
}:
-let
- # Same commit the build-time fetch (media.nix) pins, so runtime and build-time deployments
- # serve identical exercise media. Kept in sync via nix/version.nix.
- rev = "7455efae41b330c265e7cd4b78dfa848e7ce5ebd";
-in
writeShellScriptBin "opengym-fetch-media" ''
set -euo pipefail
MEDIA_DIR="''${1:?Usage: opengym-fetch-media <media-dir>}"
@@ -23,9 +19,9 @@ writeShellScriptBin "opengym-fetch-media" ''
echo "Downloading exercise media (~140 MB, one time)..."
TMPDIR=$(mktemp -d)
trap 'rm -rf "$TMPDIR"' EXIT
- ${curl}/bin/curl -fL --retry 3 "$MEDIA_URL/archive/${rev}.tar.gz" -o "$TMPDIR/dataset.tar.gz"
+ ${curl}/bin/curl -fL --retry 3 "$MEDIA_URL/archive/${datasetRev}.tar.gz" -o "$TMPDIR/dataset.tar.gz"
${gnutar}/bin/tar -xzf "$TMPDIR/dataset.tar.gz" -C "$TMPDIR"
- cp "$TMPDIR/exercises-dataset-${rev}"/images/*.jpg "$MEDIA_DIR/img/"
- cp "$TMPDIR/exercises-dataset-${rev}"/videos/*.gif "$MEDIA_DIR/gif/"
- echo "Exercise media ready (pinned to ${rev})."
+ cp "$TMPDIR/exercises-dataset-${datasetRev}"/images/*.jpg "$MEDIA_DIR/img/"
+ cp "$TMPDIR/exercises-dataset-${datasetRev}"/videos/*.gif "$MEDIA_DIR/gif/"
+ echo "Exercise media ready (pinned to ${datasetRev})."
''
\ No newline at end of file
diff --git a/nix/media.nix b/nix/media.nix
index 022b4d370..5e3d25542 100644
--- a/nix/media.nix
+++ b/nix/media.nix
@@ -1,9 +1,12 @@
-{ fetchFromGitHub }:
+{
+ fetchFromGitHub,
+ datasetRev,
+}:
fetchFromGitHub {
owner = "hasaneyldrm";
repo = "exercises-dataset";
- rev = "7455efae41b330c265e7cd4b78dfa848e7ce5ebd";
+ rev = datasetRev;
hash = "sha256-bAit6zzd1Q1SPgb3ydjuZN78yXjRcgcIs+hH4gKNaxE=";
name = "opengym-exercise-media";
-}
+}
\ No newline at end of file
diff --git a/nix/version.nix b/nix/version.nix
new file mode 100644
index 000000000..37a8121f0
--- /dev/null
+++ b/nix/version.nix
@@ -0,0 +1,8 @@
+# Single source of truth for the openGym release version and the pinned exercise-dataset
+# commit the media packages (build-time media.nix and runtime media-script.nix) agreed on.
+{
+ version = "1.2.11";
+
+ # hasaneyldrm/exercises-dataset — same commit for build-time fetch and runtime download.
+ datasetRev = "7455efae41b330c265e7cd4b78dfa848e7ce5ebd";
+}
\ No newline at end of file