flake/users/guanranwang/darwin/profiles/opt-in/clash-meta-client.nix

32 lines
734 B
Nix
Raw Normal View History

{
inputs,
pkgs,
2023-12-13 11:18:00 +00:00
lib,
...
2023-12-13 11:18:00 +00:00
}: let
env = {
2023-11-04 10:22:10 +00:00
"http_proxy" = "http://127.0.0.1:7890";
"https_proxy" = "http://127.0.0.1:7890";
"ftp_proxy" = "http://127.0.0.1:7890";
"rsync_proxy" = "http://127.0.0.1:7890";
2023-10-09 06:52:33 +00:00
};
2023-12-13 11:18:00 +00:00
in {
# TODO: not run as root
2023-10-09 06:52:33 +00:00
2023-12-13 11:18:00 +00:00
# Proxy environment variables
environment.variables = env;
launchd.daemons."nix-daemon".environment = env;
2023-10-09 06:52:33 +00:00
2023-12-13 11:18:00 +00:00
# launchd service
2023-11-04 10:22:10 +00:00
launchd.daemons."clash-meta" = {
2023-12-13 11:18:00 +00:00
command = "${lib.getExe pkgs.clash-meta} -d /etc/clash-meta";
2023-12-14 08:07:31 +00:00
serviceConfig = {
RunAtLoad = true;
KeepAlive.NetworkState = true;
};
2023-11-04 10:22:10 +00:00
};
2023-12-13 11:18:00 +00:00
# Web interface
2023-12-27 07:28:18 +00:00
environment.etc."clash-meta/metacubexd".source = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.metacubexd;
}