···
type = types.nullOr types.str;
65
-
description = "Username for basic authentication.";
65
+
description = "Username for basic http authentication.";
passwordFile = mkOption {
···
apply = value: if value == null then null else toString value;
73
-
File containing the password to use for basic authentication.
73
+
File containing the password to use for basic http authentication.
For insecurely putting the password in the globally readable store use
`pkgs.writeText "ttydpw" "MyPassword"`.
···
description = "Signal to send to the command on session close.";
85
+
entrypoint = mkOption {
86
+
type = types.listOf types.str;
87
+
default = [ "${pkgs.shadow}/bin/login" ];
88
+
defaultText = lib.literalExpression ''
89
+
[ "''${pkgs.shadow}/bin/login" ]
91
+
example = lib.literalExpression ''
92
+
[ (lib.getExe pkgs.htop) ]
94
+
description = "Which command ttyd runs.";
95
+
apply = lib.escapeShellArgs;
100
+
# `login` needs to be run as root
102
+
description = "Which unix user ttyd should run as.";
···
wantedBy = [ "multi-user.target" ];
196
-
# Runs login which needs to be run as root
197
-
# login: Cannot possibly work without effective root
LoadCredential = lib.optionalString (cfg.passwordFile != null) "TTYD_PASSWORD_FILE:${cfg.passwordFile}";
···
PASSWORD=$(cat "$CREDENTIALS_DIRECTORY/TTYD_PASSWORD_FILE")
${pkgs.ttyd}/bin/ttyd ${lib.escapeShellArgs args} \
--credential ${lib.escapeShellArg cfg.username}:"$PASSWORD" \
206
-
${pkgs.shadow}/bin/login
${pkgs.ttyd}/bin/ttyd ${lib.escapeShellArgs args} \
210
-
${pkgs.shadow}/bin/login