1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-30 18:38:31 +02:00
home-manager/modules/programs/tmate.nix
Emily 36a53d9f26 treewide: convert all option docs to Markdown
This process was automated by [my fork of `nix-doc-munge`]. All
conversions were automatically checked to produce the same DocBook
result when converted back, modulo minor typographical/formatting
differences on the acceptable-to-desirable spectrum.

To reproduce this commit, run:

  $ NIX_PATH=nixpkgs=flake:nixpkgs/e7e69199f0372364a6106a1e735f68604f4c5a25 \
    nix shell nixpkgs#coreutils \
    -c find . -name '*.nix' \
    -exec nix run -- github:emilazy/nix-doc-munge/98dadf1f77351c2ba5dcb709a2a171d655f15099 \
    {} +
  $ ./format

[my fork of `nix-doc-munge`]: https://github.com/emilazy/nix-doc-munge/tree/home-manager
2023-07-17 18:40:56 +01:00

81 lines
2.3 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.tmate;
in {
meta.maintainers = [ maintainers.jlesquembre ];
options = {
programs.tmate = {
enable = mkEnableOption (lib.mdDoc "tmate");
package = mkOption {
type = types.package;
default = pkgs.tmate;
defaultText = literalExpression "pkgs.tmate";
example = literalExpression "pkgs.tmate";
description = lib.mdDoc "The tmate package to install.";
};
host = mkOption {
type = with types; nullOr str;
default = null;
example = literalExpression "tmate.io";
description = lib.mdDoc "Tmate server address.";
};
port = mkOption {
type = with types; nullOr port;
default = null;
example = 2222;
description = lib.mdDoc "Tmate server port.";
};
dsaFingerprint = mkOption {
type = with types; nullOr string;
default = null;
example = literalExpression
"SHA256:1111111111111111111111111111111111111111111";
description = lib.mdDoc "Tmate server EdDSA key fingerprint.";
};
rsaFingerprint = mkOption {
type = with types; nullOr string;
default = null;
example = literalExpression
"SHA256:1111111111111111111111111111111111111111111";
description = lib.mdDoc "Tmate server RSA key fingerprint.";
};
extraConfig = mkOption {
type = types.lines;
default = "";
description = lib.mdDoc ''
Additional content written at the end of
{file}`~/.tmate.conf`.
'';
};
};
};
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.file.".tmate.conf".text = let
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;
in concatStringsSep "\n" conf + "\n";
};
}