2023-12-25 07:23:54 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
services.clash = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.clash-meta;
|
|
|
|
configFile = config.sops.templates."clash.yaml".path;
|
2023-12-27 07:28:18 +00:00
|
|
|
webui = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.metacubexd;
|
2023-12-25 07:23:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
### sops-nix
|
|
|
|
sops.secrets = builtins.mapAttrs (_name: value: value // {restartUnits = ["clash.service"];}) {
|
|
|
|
"clash/proxy-providers/efcloud" = {};
|
|
|
|
"clash/proxy-providers/spcloud" = {};
|
|
|
|
"clash/proxy-providers/pawdroid" = {};
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: Using example config
|
|
|
|
# https://wiki.metacubex.one/example/conf/
|
|
|
|
# MetaCubeX/Meta-Docs doesnt look reliable through commit messages, no fetchers was used
|
2023-12-26 06:42:06 +00:00
|
|
|
sops.templates."clash.yaml".content =
|
|
|
|
builtins.readFile ./config.yaml
|
|
|
|
+ ''
|
|
|
|
proxy-providers:
|
|
|
|
efcloud:
|
|
|
|
<<: *p
|
|
|
|
url: "${config.sops.placeholder."clash/proxy-providers/efcloud"}"
|
|
|
|
spcloud:
|
|
|
|
<<: *p
|
|
|
|
url: "${config.sops.placeholder."clash/proxy-providers/spcloud"}"
|
|
|
|
#pawdroid:
|
|
|
|
# <<: *p
|
|
|
|
# url: "${config.sops.placeholder."clash/proxy-providers/pawdroid"}"
|
|
|
|
'';
|
2023-12-25 07:23:54 +00:00
|
|
|
|
|
|
|
### System proxy settings
|
|
|
|
networking.proxy.default = "http://127.0.0.1:7890/";
|
|
|
|
|
|
|
|
### Local Clash WebUI
|
|
|
|
# You can also use the following website, just in case:
|
|
|
|
# - metacubexd:
|
|
|
|
# - GH Pages Custom Domain: http://d.metacubex.one
|
|
|
|
# - GH Pages: https://metacubex.github.io/metacubexd
|
|
|
|
# - Cloudflare Pages: https://metacubexd.pages.dev
|
|
|
|
# - yacd (Yet Another Clash Dashboard):
|
|
|
|
# - https://yacd.haishan.me
|
|
|
|
# - clash-dashboard (buggy):
|
|
|
|
# - https://clash.razord.top
|
|
|
|
}
|