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
feat: add environment and environmentFile options to the NixOS module
gerrydorod8c5bab3acc4
diff --git a/flake.nix b/flake.nixindex df142334e..ec42bd44e 100644--- a/flake.nix+++ b/flake.nix@@ -38,6 +38,7 @@rpId = "localhost";origin = "http://localhost:8080";apiPort = 3000;+ environment = { MY_FLAG = "1"; };media.fetchAtBuild = true;};system.stateVersion = "25.05";@@ -60,6 +61,9 @@# Verify systemd service existsecho "systemd.services.opengym-api exists = ${if testConfig.config.systemd.services ? opengym-api then "true" else "false"}"+ # Verify extra environment is applied to the API unit+ echo "opengym-api env MY_FLAG = ${if testConfig.config.systemd.services.opengym-api.environment ? MY_FLAG then testConfig.config.systemd.services.opengym-api.environment.MY_FLAG else "missing"}"+# Verify nginx is disabled (system uses Caddy)echo "services.nginx.enable = ${if nginxEnabled then "true" else "false"}"diff --git a/nix/opengym.nix b/nix/opengym.nixindex 38b618450..af1c9537d 100644--- a/nix/opengym.nix+++ b/nix/opengym.nix@@ -136,6 +136,25 @@ indescription = "VAPID subject for push notifications (defaults to ORIGIN).";};+ environment = lib.mkOption {+ type = lib.types.attrsOf lib.types.str;+ default = { };+ description = ''+ Extra environment variables set on the opengym-api systemd unit. Useful for variables the+ module does not manage yet. Variables this module already derives from its own options take+ precedence. Mutually exclusive with environmentFile.+ '';+ };++ environmentFile = lib.mkOption {+ type = lib.types.str;+ default = "";+ description = ''+ Path to an env file (KEY=VALUE per line) read by the opengym-api systemd unit. Mutually+ exclusive with environment.+ '';+ };+media = {fetchAtBuild = lib.mkOption {type = lib.types.bool;@@ -175,7 +194,16 @@ in};};- config = lib.mkIf cfg.enable {+ config = lib.mkMerge [+ {+ assertions = [+ {+ assertion = cfg.environment == { } || cfg.environmentFile == "";+ message = "services.opengym.environment and services.opengym.environmentFile are mutually exclusive; use only one.";+ }+ ];+ }+ (lib.mkIf cfg.enable {users.users.opengym = {isSystemUser = true;@@ -194,7 +222,7 @@ indescription = "openGym API server";after = [ "network.target" ];wantedBy = [ "multi-user.target" ];- environment = apiEnv;+ environment = cfg.environment // apiEnv;serviceConfig = {ExecStart = "${packages.opengym-api}/bin/opengym-api";User = "opengym";@@ -203,6 +231,7 @@ inStateDirectoryMode = "0750";Restart = "on-failure";RestartSec = 5;+ EnvironmentFile = lib.mkIf (cfg.environmentFile != "") cfg.environmentFile;NoNewPrivileges = true;ProtectSystem = "strict";@@ -263,5 +292,6 @@ inRestart = "on-failure";};};- };+ })+];}