lol

nixos/workout-tracker: init

+116
+2
nixos/doc/manual/release-notes/rl-2405.section.md
··· 95 95 96 96 - [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). 97 97 98 + - [Workout-tracker](https://github.com/jovandeginste/workout-tracker), a workout tracking web application for personal use. 99 + 98 100 - [Python Matter Server](https://github.com/home-assistant-libs/python-matter-server), a 99 101 Matter Controller Server exposing websocket connections for use with other services, notably Home Assistant. 100 102 Available as [services.matter-server](#opt-services.matter-server.enable)
+1
nixos/modules/module-list.nix
··· 796 796 ./services/misc/tzupdate.nix 797 797 ./services/misc/uhub.nix 798 798 ./services/misc/weechat.nix 799 + ./services/misc/workout-tracker.nix 799 800 ./services/misc/xmr-stak.nix 800 801 ./services/misc/xmrig.nix 801 802 ./services/misc/zoneminder.nix
+83
nixos/modules/services/misc/workout-tracker.nix
··· 1 + { 2 + config, 3 + lib, 4 + pkgs, 5 + ... 6 + }: 7 + 8 + let 9 + inherit (lib) types; 10 + cfg = config.services.workout-tracker; 11 + stateDir = "workout-tracker"; 12 + in 13 + 14 + { 15 + options = { 16 + services.workout-tracker = { 17 + enable = lib.mkEnableOption "workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities"; 18 + 19 + package = lib.mkPackageOption pkgs "workout-tracker" { }; 20 + 21 + address = lib.mkOption { 22 + type = types.str; 23 + default = "127.0.0.1"; 24 + description = "Web interface address."; 25 + }; 26 + 27 + port = lib.mkOption { 28 + type = types.port; 29 + default = 8080; 30 + description = "Web interface port."; 31 + }; 32 + 33 + environmentFile = lib.mkOption { 34 + type = types.nullOr types.path; 35 + default = null; 36 + example = "/run/keys/workout-tracker.env"; 37 + description = '' 38 + An environment file as defined in {manpage}`systemd.exec(5)`. 39 + 40 + Secrets like `WT_JWT_ENCRYPTION_KEY` may be passed to the service without adding them 41 + to the world-readable Nix store. 42 + ''; 43 + }; 44 + 45 + settings = lib.mkOption { 46 + type = types.attrsOf types.str; 47 + 48 + default = { }; 49 + description = '' 50 + Extra config options. 51 + ''; 52 + example = { 53 + WT_LOGGING = "true"; 54 + WT_DEBUG = "false"; 55 + WT_DATABASE_DRIVER = "sqlite"; 56 + WT_DSN = "./database.db"; 57 + }; 58 + }; 59 + }; 60 + }; 61 + 62 + config = lib.mkIf cfg.enable { 63 + systemd.services.workout-tracker = { 64 + description = "A workout tracking web application for personal use (or family, friends), geared towards running and other GPX-based activities"; 65 + wantedBy = [ "multi-user.target" ]; 66 + environment = { 67 + WT_BIND = "${cfg.address}:${toString cfg.port}"; 68 + WT_DATABASE_DRIVER = "sqlite"; 69 + WT_DSN = "./database.db"; 70 + } // cfg.settings; 71 + serviceConfig = { 72 + ExecStart = lib.getExe cfg.package; 73 + DynamicUser = true; 74 + StateDirectory = stateDir; 75 + WorkingDirectory = "%S/${stateDir}"; 76 + Restart = "always"; 77 + EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile; 78 + }; 79 + }; 80 + }; 81 + 82 + meta.maintainers = with lib.maintainers; [ bhankas ]; 83 + }
+1
nixos/tests/all-tests.nix
··· 991 991 wireguard = handleTest ./wireguard {}; 992 992 without-nix = handleTest ./without-nix.nix {}; 993 993 wmderland = handleTest ./wmderland.nix {}; 994 + workout-tracker = handleTest ./workout-tracker.nix {}; 994 995 wpa_supplicant = handleTest ./wpa_supplicant.nix {}; 995 996 wordpress = handleTest ./wordpress.nix {}; 996 997 wrappers = handleTest ./wrappers.nix {};
+29
nixos/tests/workout-tracker.nix
··· 1 + import ./make-test-python.nix ( 2 + { lib, pkgs, ... }: 3 + 4 + { 5 + name = "workout-tracker"; 6 + 7 + meta.maintainers = with lib.maintainers; [ bhankas ]; 8 + 9 + nodes.machine = 10 + { config, ... }: 11 + { 12 + virtualisation.memorySize = 2048; 13 + 14 + services.workout-tracker.enable = true; 15 + }; 16 + 17 + testScript = '' 18 + start_all() 19 + machine.wait_for_unit("workout-tracker.service") 20 + # wait for workout-tracker to fully come up 21 + 22 + with subtest("workout-tracker service starts"): 23 + machine.wait_until_succeeds( 24 + "curl -sSfL http://localhost:8080/ > /dev/null", 25 + timeout=30 26 + ) 27 + ''; 28 + } 29 + )