/ nix / modules / web-terminal.nix
web-terminal.nix
 1  { config, pkgs, lib, ... }:
 2  
 3  {
 4    systemd.services.bob-web-terminal = {
 5      description = "Bob Web Terminal — shared Claude Code session over WebSocket";
 6      after = [ "network.target" ];
 7      wantedBy = [ "multi-user.target" ];
 8  
 9      environment = {
10        PORT = "10850";
11        CLAUDE_DIR = "/home/rig/bob";
12        CLAUDE_BIN = "/home/rig/.bun/bin/claude";
13        HOME = "/home/rig";
14        PATH = lib.mkForce "/home/rig/.bun/bin:/home/rig/.nix-profile/bin:/run/current-system/sw/bin:/usr/bin:/bin";
15        NODE_ENV = "production";
16      };
17  
18      serviceConfig = {
19        Type = "simple";
20        User = "rig";
21        Group = "users";
22        WorkingDirectory = "/home/rig/bob/web-terminal";
23        ExecStart = "${pkgs.nodejs_22}/bin/node server.mjs";
24        Restart = "on-failure";
25        RestartSec = 5;
26      };
27    };
28  }