Merge pull request #167775 from otavio/topic/improve-shellhub-module
nixos: shellhub-agent: support more options
This commit is contained in:
commit
3a570f57a1
|
@ -1,31 +1,37 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.shellhub-agent;
|
cfg = config.services.shellhub-agent;
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
###### interface
|
###### interface
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
services.shellhub-agent = {
|
services.shellhub-agent = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkEnableOption "ShellHub Agent daemon";
|
||||||
type = types.bool;
|
|
||||||
default = false;
|
package = mkPackageOption pkgs "shellhub-agent" { };
|
||||||
|
|
||||||
|
preferredHostname = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable the ShellHub Agent daemon, which allows
|
Set the device preferred hostname. This provides a hint to
|
||||||
secure remote logins.
|
the server to use this as hostname if it is available.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
keepAliveInterval = mkOption {
|
||||||
type = types.package;
|
type = types.int;
|
||||||
default = pkgs.shellhub-agent;
|
default = 30;
|
||||||
defaultText = literalExpression "pkgs.shellhub-agent";
|
|
||||||
description = ''
|
description = ''
|
||||||
Which ShellHub Agent package to use.
|
Determine the interval to send the keep alive message to
|
||||||
|
the server. This has a direct impact of the bandwidth
|
||||||
|
used by the device.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,9 +80,13 @@ in {
|
||||||
"time-sync.target"
|
"time-sync.target"
|
||||||
];
|
];
|
||||||
|
|
||||||
environment.SERVER_ADDRESS = cfg.server;
|
environment = {
|
||||||
environment.PRIVATE_KEY = cfg.privateKey;
|
SHELLHUB_SERVER_ADDRESS = cfg.server;
|
||||||
environment.TENANT_ID = cfg.tenantId;
|
SHELLHUB_PRIVATE_KEY = cfg.privateKey;
|
||||||
|
SHELLHUB_TENANT_ID = cfg.tenantId;
|
||||||
|
SHELLHUB_KEEPALIVE_INTERVAL = toString cfg.keepAliveInterval;
|
||||||
|
SHELLHUB_PREFERRED_HOSTNAME = cfg.preferredHostname;
|
||||||
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
# The service starts sessions for different users.
|
# The service starts sessions for different users.
|
||||||
|
@ -85,7 +95,6 @@ in {
|
||||||
ExecStart = "${cfg.package}/bin/agent";
|
ExecStart = "${cfg.package}/bin/agent";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = [ cfg.package ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue