mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
`literalExpression` is intended just to signify code that needs to stay a string that gets represented exactly as-is for docs. It has been misused heavily and people get confused repeatedly on when or not to use it because of the rampant misuse.
83 lines
2.0 KiB
Nix
83 lines
2.0 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
inherit (lib)
|
|
mkOption
|
|
optional
|
|
types
|
|
;
|
|
|
|
cfg = config.programs.tmate;
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.jlesquembre ];
|
|
|
|
options = {
|
|
programs.tmate = {
|
|
enable = lib.mkEnableOption "tmate";
|
|
|
|
package = lib.mkPackageOption pkgs "tmate" { };
|
|
|
|
host = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
example = "tmate.io";
|
|
description = "Tmate server address.";
|
|
};
|
|
|
|
port = mkOption {
|
|
type = with types; nullOr port;
|
|
default = null;
|
|
example = 2222;
|
|
description = "Tmate server port.";
|
|
};
|
|
|
|
dsaFingerprint = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
example = "SHA256:1111111111111111111111111111111111111111111";
|
|
description = "Tmate server EdDSA key fingerprint.";
|
|
};
|
|
|
|
rsaFingerprint = mkOption {
|
|
type = with types; nullOr str;
|
|
default = null;
|
|
example = "SHA256:1111111111111111111111111111111111111111111";
|
|
description = "Tmate server RSA key fingerprint.";
|
|
};
|
|
|
|
extraConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
description = ''
|
|
Additional content written at the end of
|
|
{file}`~/.tmate.conf`.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
home.file.".tmate.conf" =
|
|
let
|
|
conf =
|
|
optional (cfg.host != null) ''set -g tmate-server-host "${cfg.host}"''
|
|
++ optional (cfg.port != null) "set -g tmate-server-port ${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;
|
|
in
|
|
lib.mkIf (conf != [ ]) { text = lib.concatLines conf; };
|
|
};
|
|
}
|