1 { config, lib, pkgs, ... }:
6 cfg = config.services.shellhub-agent;
13 services.shellhub-agent = {
15 enable = mkEnableOption "ShellHub Agent daemon";
17 package = mkPackageOption pkgs "shellhub-agent" { };
19 preferredHostname = mkOption {
23 Set the device preferred hostname. This provides a hint to
24 the server to use this as hostname if it is available.
28 keepAliveInterval = mkOption {
32 Determine the interval to send the keep alive message to
33 the server. This has a direct impact of the bandwidth
40 example = "ba0a880c-2ada-11eb-a35e-17266ef329d6";
42 The tenant ID to use when connecting to the ShellHub
49 default = "https://cloud.shellhub.io";
51 Server address of ShellHub Gateway to connect.
55 privateKey = mkOption {
57 default = "/var/lib/shellhub-agent/private.key";
59 Location where to store the ShellHub Agent private
68 config = mkIf cfg.enable {
70 systemd.services.shellhub-agent = {
71 description = "ShellHub Agent";
73 wantedBy = [ "multi-user.target" ];
74 requires = [ "local-fs.target" ];
75 wants = [ "network-online.target" ];
79 "network-online.target"
84 SHELLHUB_SERVER_ADDRESS = cfg.server;
85 SHELLHUB_PRIVATE_KEY = cfg.privateKey;
86 SHELLHUB_TENANT_ID = cfg.tenantId;
87 SHELLHUB_KEEPALIVE_INTERVAL = toString cfg.keepAliveInterval;
88 SHELLHUB_PREFERRED_HOSTNAME = cfg.preferredHostname;
92 # The service starts sessions for different users.
94 Restart = "on-failure";
95 ExecStart = "${cfg.package}/bin/agent";