fork/home-manager
git clone https://git.julia.blue/fork/home-manager
7b8d43fb
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . programs . tmate ; 8 9in { 10meta . maintainers = [ maintainers . jlesquembre ]; 11 12options = { 13programs . tmate = { 14enable = mkEnableOption "tmate" ; 15 16package = mkOption { 17type = types . package ; 18default = pkgs . tmate ; 19defaultText = literalExpression "pkgs.tmate" ; 20example = literalExpression "pkgs.tmate" ; 21description = "The tmate package to install." ; 22}; 23 24host = mkOption { 25type = with types ; nullOr str ; 26default = null ; 27example = literalExpression "tmate.io" ; 28description = "Tmate server address." ; 29}; 30 31port = mkOption { 32type = with types ; nullOr port ; 33default = null ; 34example = 2222 ; 35description = "Tmate server port." ; 36}; 37 38dsaFingerprint = mkOption { 39type = with types ; nullOr str ; 40default = null ; 41example = literalExpression 42"SHA256:1111111111111111111111111111111111111111111" ; 43description = "Tmate server EdDSA key fingerprint." ; 44}; 45 46rsaFingerprint = mkOption { 47type = with types ; nullOr str ; 48default = null ; 49example = literalExpression 50"SHA256:1111111111111111111111111111111111111111111" ; 51description = "Tmate server RSA key fingerprint." ; 52}; 53 54extraConfig = mkOption { 55type = types . lines ; 56default = "" ; 57description = '' 58Additional content written at the end of 59{file}`~/.tmate.conf`. 60'' ; 61}; 62}; 63}; 64 65config = mkIf cfg . enable { 66home . packages = [ cfg . package ]; 67 68home . file . ".tmate.conf" = let 69conf = 70optional ( cfg . host != null ) ''set -g tmate-server-host " ${ cfg . host } "'' 71++ optional ( cfg . port != null ) 72"set -g tmate-server-port ${ builtins . toString cfg . port } " 73++ optional ( cfg . dsaFingerprint != null ) 74''set -g tmate-server-ed25519-fingerprint " ${ cfg . dsaFingerprint } "'' 75++ optional ( cfg . rsaFingerprint != null ) 76''set -g tmate-server-rsa-fingerprint " ${ cfg . rsaFingerprint } "'' 77++ optional ( cfg . extraConfig != "" ) cfg . extraConfig ; 78in mkIf ( conf != [ ]) { text = concatLines conf ; }; 79}; 80}