nixos/clash: add option descriptions

This commit is contained in:
Guanran Wang 2023-12-31 20:22:48 +08:00
parent 3bced27e51
commit 9cac96c5ff
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -7,21 +7,34 @@
cfg = config.services.clash;
in {
options.services.clash = {
enable = lib.mkEnableOption "Whether to enable Clash, A rule-based proxy in Go";
enable = lib.mkEnableOption "Whether to enable Clash, A rule-based proxy in Go.";
package = lib.mkPackageOption pkgs "clash" {};
# TODO
webui = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
};
configFile = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
description = "Configuration file to use.";
};
webui = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
description = ''
Local web interface to use.
You can also use the following website, just in case:
- metacubexd:
- http://d.metacubex.one
- https://metacubex.github.io/metacubexd
- https://metacubexd.pages.dev
- yacd:
- https://yacd.haishan.me
- clash-dashboard (buggy):
- https://clash.razord.top
'';
};
extraOpts = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.string;
description = "Extra command line options to use.";
};
};
@ -52,8 +65,8 @@ in {
ExecStart = builtins.replaceStrings ["\n"] [" "] ''
${lib.getExe cfg.package}
-d /etc/clash
${lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}"}
${lib.optionalString (cfg.configFile != null) "-f \${CREDENTIALS_DIRECTORY}/configuration"}
${lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}"}
${lib.optionalString (cfg.extraOpts != null) cfg.extraOpts}
'';