···
cfg = config.services.newt;
22
+
description = "value coercible to CLI argument";
27
+
(lib.mkRenamedOptionModule [ "services" "newt" "id" ] [ "services" "newt" "settings" "id" ])
28
+
(lib.mkRenamedOptionModule
29
+
[ "services" "newt" "logLevel" ]
30
+
[ "services" "newt" "settings" "log-level" ]
32
+
(lib.mkRenamedOptionModule
33
+
[ "services" "newt" "endpoint" ]
34
+
[ "services" "newt" "settings" "endpoint" ]
enable = lib.mkEnableOption "Newt, user space tunnel client for Pangolin";
14
-
# needs to be changed when newt-go changes to fosrl-newt
15
-
package = lib.mkPackageOption pkgs "newt-go" { };
41
+
package = lib.mkPackageOption pkgs "fosrl-newt" { };
42
+
settings = lib.mkOption {
46
+
endpoint = "pangolin.example.com";
47
+
id = "8yfsghj438a20ol";
49
+
description = "Settings for Newt module, see [Newt CLI docs](https://github.com/fosrl/newt?tab=readme-ov-file#cli-args) for more information.";
18
-
type = with lib.types; nullOr str;
21
-
The Newt Id that will be used to communicate to Pangolin. This is generated on site creation in the dashboard.
24
-
endpoint = lib.mkOption {
25
-
type = with lib.types; nullOr str;
28
-
The endpoint where both Gerbil and Pangolin reside in order to connect to the websocket. The url of your Pangolin dashboard.
31
-
logLevel = lib.mkOption {
32
-
type = lib.types.enum [
40
-
description = "The log level to use.";
# provide path to file to keep secrets out of the nix store
environmentFile = lib.mkOption {
type = with lib.types; nullOr path;
···
HOME = "/var/lib/private/newt";
# the flag values will all be overwritten if also defined in the env file
76
-
exec ${lib.getExe pkgs.newt-go} \\\n
77
-
${lib.optionalString (
79
-
) "--id ${cfg.id} \\\n"}
80
-
${lib.optionalString (
81
-
!isNull cfg.endpoint
82
-
) "--endpoint ${cfg.endpoint} \\\n"}
83
-
--log-level ${cfg.logLevel}
86
+
ExecStart = "${lib.getExe cfg.package} ${lib.cli.toGNUCommandLineShell { } cfg.settings}";
StateDirectoryMode = "0700";