From b6a7454f1da7a51f7352cb5379ecfd3bf70fceb7 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Tue, 10 Feb 2026 00:44:54 -0600 Subject: [PATCH] ttyd for lio tailnet --- hosts/lio/flake.lock | 8 ++++---- hosts/lio/flake.nix | 1 + hosts/lio/ttyd-mobile.css | 38 ++++++++++++++++++++++++++++++++++++++ hosts/lio/ttyd.nix | 21 +++++++++++++++++++++ 4 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 hosts/lio/ttyd-mobile.css create mode 100644 hosts/lio/ttyd.nix diff --git a/hosts/lio/flake.lock b/hosts/lio/flake.lock index 2e3220fe..2cec9ecc 100644 --- a/hosts/lio/flake.lock +++ b/hosts/lio/flake.lock @@ -64,11 +64,11 @@ "common": { "locked": { "dir": "flakes/common", - "lastModified": 1770664771, - "narHash": "sha256-8X1QU1bmy0hQe2PnpVcg1trna4BO+bpTpC79mWsz1rY=", + "lastModified": 1770702882, + "narHash": "sha256-IrNAJIl5Pzpr9pZjHEEuVmJNawK9k2vFUgfTbw7zin4=", "ref": "refs/heads/master", - "rev": "94249e7bcbfed6a04baa01972661bd1901a95f68", - "revCount": 1248, + "rev": "b5fd37ef8cade4cd833bc62f59bed44e23a281ac", + "revCount": 1253, "type": "git", "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" }, diff --git a/hosts/lio/flake.nix b/hosts/lio/flake.nix index 737f9394..342929e7 100644 --- a/hosts/lio/flake.nix +++ b/hosts/lio/flake.nix @@ -175,6 +175,7 @@ # ./sway_customizations.nix # ./i3_customizations.nix ./vms.nix + ./ttyd.nix ( { config, diff --git a/hosts/lio/ttyd-mobile.css b/hosts/lio/ttyd-mobile.css new file mode 100644 index 00000000..57e40de2 --- /dev/null +++ b/hosts/lio/ttyd-mobile.css @@ -0,0 +1,38 @@ +/* Mobile-friendly TTYD styles */ +html, body { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +#terminal-container, .terminal, .xterm { + width: 100vw !important; + max-width: 100vw !important; + height: 100vh !important; + overflow: hidden !important; + box-sizing: border-box !important; +} + +.xterm-viewport { + overflow-y: auto !important; + overflow-x: hidden !important; +} + +/* Prevent horizontal scroll on mobile */ +.xterm-screen { + max-width: 100vw !important; +} + +/* Better touch scrolling */ +.xterm-viewport::-webkit-scrollbar { + width: 8px; +} + +/* Ensure proper viewport on iOS */ +@supports (-webkit-touch-callout: none) { + #terminal-container, .terminal, .xterm { + height: -webkit-fill-available !important; + } +} diff --git a/hosts/lio/ttyd.nix b/hosts/lio/ttyd.nix new file mode 100644 index 00000000..69ba3c12 --- /dev/null +++ b/hosts/lio/ttyd.nix @@ -0,0 +1,21 @@ +{ + pkgs, + ... +}: +{ + systemd.services.ttyd = { + description = "TTYD - Web Terminal"; + after = [ "network.target" "tailscaled.service" ]; + wants = [ "tailscaled.service" ]; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + Type = "simple"; + User = "josh"; + Group = "users"; + ExecStart = "${pkgs.ttyd}/bin/ttyd -p 8383 -i 100.64.0.1 -W -c :root -t fontSize=56 -t rendererType=webgl -t disableLeaveAlert=true ${pkgs.zsh}/bin/zsh"; + Restart = "on-failure"; + RestartSec = "5s"; + }; + }; +}