mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
tmate: add module
This commit is contained in:
parent
9b91709899
commit
707cb75ed3
7 changed files with 118 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -298,6 +298,9 @@ Makefile @thiagokokada
|
|||
|
||||
/modules/programs/tiny.nix @kmaasrud
|
||||
|
||||
/modules/programs/tmate.nix @jlesquembre
|
||||
/tests/modules/programs/tmate @jlesquembre
|
||||
|
||||
/modules/programs/topgrade.nix @msfjarvis
|
||||
/tests/modules/programs/topgrade @msfjarvis
|
||||
|
||||
|
|
|
@ -712,6 +712,13 @@ in
|
|||
A new module is available: 'services.safeeyes'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2022-09-25T22:22:17+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.tmate'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -170,6 +170,7 @@ let
|
|||
./programs/timidity.nix
|
||||
./programs/tint2.nix
|
||||
./programs/tiny.nix
|
||||
./programs/tmate.nix
|
||||
./programs/tmux.nix
|
||||
./programs/topgrade.nix
|
||||
./programs/urxvt.nix
|
||||
|
|
80
modules/programs/tmate.nix
Normal file
80
modules/programs/tmate.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.tmate;
|
||||
|
||||
in {
|
||||
meta.maintainers = [ maintainers.jlesquembre ];
|
||||
|
||||
options = {
|
||||
programs.tmate = {
|
||||
enable = mkEnableOption "tmate";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.tmate;
|
||||
defaultText = literalExpression "pkgs.tmate";
|
||||
example = literalExpression "pkgs.tmate";
|
||||
description = "The tmate package to install.";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
example = literalExpression "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 string;
|
||||
default = null;
|
||||
example = literalExpression
|
||||
"SHA256:1111111111111111111111111111111111111111111";
|
||||
description = "Tmate server EdDSA key fingerprint.";
|
||||
};
|
||||
|
||||
rsaFingerprint = mkOption {
|
||||
type = with types; nullOr string;
|
||||
default = null;
|
||||
example = literalExpression
|
||||
"SHA256:1111111111111111111111111111111111111111111";
|
||||
description = "Tmate server RSA key fingerprint.";
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
description = ''
|
||||
Additional content written at the end of
|
||||
<filename>~/.tmate.conf</filename>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
}
|
|
@ -114,6 +114,7 @@ import nmt {
|
|||
./modules/programs/starship
|
||||
./modules/programs/taskwarrior
|
||||
./modules/programs/texlive
|
||||
./modules/programs/tmate
|
||||
./modules/programs/tmux
|
||||
./modules/programs/topgrade
|
||||
./modules/programs/vscode
|
||||
|
|
1
tests/modules/programs/tmate/default.nix
Normal file
1
tests/modules/programs/tmate/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ tmate = ./tmate.nix; }
|
25
tests/modules/programs/tmate/tmate.nix
Normal file
25
tests/modules/programs/tmate/tmate.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.tmate = {
|
||||
enable = true;
|
||||
port = 222;
|
||||
dsaFingerprint = "SHA256:1111111111111111111111111111111111111111111";
|
||||
extraConfig = ''set tmate-session-name "session-name"'';
|
||||
};
|
||||
|
||||
test.stubs.tmate = { };
|
||||
|
||||
nmt.script = let
|
||||
expectedConfig = ''
|
||||
set -g tmate-server-port 222
|
||||
set -g tmate-server-ed25519-fingerprint "SHA256:1111111111111111111111111111111111111111111"
|
||||
set tmate-session-name "session-name"
|
||||
'';
|
||||
in ''
|
||||
assertFileExists home-files/.tmate.conf
|
||||
assertFileContent home-files/.tmate.conf ${
|
||||
builtins.toFile "config" expectedConfig
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue