Add gotty web service, and use it in sensuous (#97)

This commit is contained in:
Sridhar Ratnakumar 2025-09-09 18:13:27 -04:00 committed by GitHub
parent 74162ecdb5
commit de60109903
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 60 additions and 0 deletions

View file

@ -11,4 +11,11 @@ in
];
home.username = "srid";
services.gotty = {
enable = true;
port = 9000;
command = "tmux new-session -A -s gotty";
write = true;
};
}

View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.gotty;
in
{
options.services.gotty = {
enable = mkEnableOption "GoTTY web terminal service";
port = mkOption {
type = types.int;
default = 8080;
description = "Port number for GoTTY to listen on";
};
command = mkOption {
type = types.str;
default = "${pkgs.bash}/bin/bash";
description = "Command to execute in the terminal";
};
write = mkOption {
type = types.bool;
default = false;
description = "Allow clients to write to the terminal";
};
};
config = mkIf cfg.enable {
home.packages = [ pkgs.gotty ];
systemd.user.services.gotty = {
Unit = {
Description = "GoTTY web terminal service";
After = [ "network.target" ];
};
Service = {
Type = "simple";
ExecStart = "${pkgs.gotty}/bin/gotty -p ${toString cfg.port}${optionalString cfg.write " -w"} ${cfg.command}";
Restart = "always";
RestartSec = 5;
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
}

View file

@ -12,6 +12,7 @@
# ./all/zellij.nix
./all/just.nix
# ./all/juspay.nix
./all/gotty.nix
./claude-code
];