2022-09-21 22:59:50 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.programs.tmate;
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.jlesquembre ];
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.tmate = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "tmate";
|
2022-09-21 22:59:50 +02:00
|
|
|
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.tmate;
|
|
|
|
defaultText = literalExpression "pkgs.tmate";
|
|
|
|
example = literalExpression "pkgs.tmate";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "The tmate package to install.";
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
host = mkOption {
|
|
|
|
type = with types; nullOr str;
|
|
|
|
default = null;
|
|
|
|
example = literalExpression "tmate.io";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Tmate server address.";
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
port = mkOption {
|
|
|
|
type = with types; nullOr port;
|
|
|
|
default = null;
|
|
|
|
example = 2222;
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Tmate server port.";
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
dsaFingerprint = mkOption {
|
2023-08-08 17:00:24 +02:00
|
|
|
type = with types; nullOr str;
|
2022-09-21 22:59:50 +02:00
|
|
|
default = null;
|
|
|
|
example = literalExpression
|
|
|
|
"SHA256:1111111111111111111111111111111111111111111";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Tmate server EdDSA key fingerprint.";
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
rsaFingerprint = mkOption {
|
2023-08-08 17:00:24 +02:00
|
|
|
type = with types; nullOr str;
|
2022-09-21 22:59:50 +02:00
|
|
|
default = null;
|
|
|
|
example = literalExpression
|
|
|
|
"SHA256:1111111111111111111111111111111111111111111";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = "Tmate server RSA key fingerprint.";
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2022-09-21 22:59:50 +02:00
|
|
|
Additional content written at the end of
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`~/.tmate.conf`.
|
2022-09-21 22:59:50 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2023-07-24 16:17:31 +02:00
|
|
|
home.file.".tmate.conf" = let
|
2022-09-21 22:59:50 +02:00
|
|
|
conf =
|
|
|
|
optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"''
|
|
|
|
++ optional (cfg.port != null)
|
|
|
|
"set -g tmate-server-port ${builtins.toString cfg.port}"
|
|
|
|
++ optional (cfg.dsaFingerprint != null)
|
|
|
|
''set -g tmate-server-ed25519-fingerprint "${cfg.dsaFingerprint}"''
|
|
|
|
++ optional (cfg.rsaFingerprint != null)
|
|
|
|
''set -g tmate-server-rsa-fingerprint "${cfg.rsaFingerprint}"''
|
|
|
|
++ optional (cfg.extraConfig != "") cfg.extraConfig;
|
2023-07-24 16:17:31 +02:00
|
|
|
in mkIf (conf != [ ]) { text = concatLines conf; };
|
2022-09-21 22:59:50 +02:00
|
|
|
};
|
|
|
|
}
|