mirror of
https://github.com/srid/nixos-config.git
synced 2026-07-16 22:01:33 +08:00
Add gotty web service, and use it in sensuous (#97)
This commit is contained in:
parent
74162ecdb5
commit
de60109903
3 changed files with 60 additions and 0 deletions
|
|
@ -11,4 +11,11 @@ in
|
|||
];
|
||||
|
||||
home.username = "srid";
|
||||
|
||||
services.gotty = {
|
||||
enable = true;
|
||||
port = 9000;
|
||||
command = "tmux new-session -A -s gotty";
|
||||
write = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
52
modules/home/all/gotty.nix
Normal file
52
modules/home/all/gotty.nix
Normal 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" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -12,6 +12,7 @@
|
|||
# ./all/zellij.nix
|
||||
./all/just.nix
|
||||
# ./all/juspay.nix
|
||||
./all/gotty.nix
|
||||
|
||||
./claude-code
|
||||
];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue