diff --git a/nixos/modules/services/clash.nix b/nixos/modules/services/clash.nix index 5a926d7..97d1d11 100644 --- a/nixos/modules/services/clash.nix +++ b/nixos/modules/services/clash.nix @@ -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} '';