darwin: clash-meta daemon with launchd
This commit is contained in:
parent
1f84c9ece5
commit
3fd1a9cb5a
4 changed files with 38 additions and 10 deletions
|
@ -3,5 +3,6 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./dns.nix
|
./dns.nix
|
||||||
|
./proxy.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
27
darwin/networking/proxy.nix
Normal file
27
darwin/networking/proxy.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
# README!!:
|
||||||
|
# I HAVE NO IDEA HOW LAUNCHD DAEMON WORKS
|
||||||
|
# USE AT YOUR OWN RISK
|
||||||
|
# it just works™
|
||||||
|
#
|
||||||
|
# Remember to manually copy `config.yaml` to `/etc/clash-meta`
|
||||||
|
# I have no idea how to get sops-nix working on darwin...
|
||||||
|
#
|
||||||
|
|
||||||
|
{
|
||||||
|
#environment.systemPackages = with pkgs; [ clash-meta ];
|
||||||
|
# do i even need to add it to environment.systemPackages...
|
||||||
|
launchd.daemons."clash-meta" = {
|
||||||
|
command = "${pkgs.clash-meta}/bin/clash-meta -d /etc/clash-meta";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.variables = {
|
||||||
|
"https_proxy" = "http://127.0.0.1:7890";
|
||||||
|
"http_proxy" = "http://127.0.0.1:7890";
|
||||||
|
"socks_proxy" = "socks5://127.0.0.1:7890";
|
||||||
|
"all_proxy" = "socks5://127.0.0.1:7890";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."clash-meta/metacubexd".source = ../../users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd;
|
||||||
|
}
|
|
@ -15,7 +15,7 @@
|
||||||
"alt-tab"
|
"alt-tab"
|
||||||
"altserver"
|
"altserver"
|
||||||
"balenaetcher"
|
"balenaetcher"
|
||||||
"clashx"
|
#"clashx"
|
||||||
"opencore-patcher"
|
"opencore-patcher"
|
||||||
|
|
||||||
#"element"
|
#"element"
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
username = "guanranwang";
|
username = "guanranwang";
|
||||||
homeDirectory = "/Users/guanranwang";
|
homeDirectory = "/Users/guanranwang";
|
||||||
|
|
||||||
|
activation = {
|
||||||
# Workaround for spotlight indexing
|
# Workaround for spotlight indexing
|
||||||
# https://github.com/nix-community/home-manager/issues/1341#issuecomment-1705731962_
|
# https://github.com/nix-community/home-manager/issues/1341#issuecomment-1705731962_
|
||||||
activation = {
|
|
||||||
trampolineApps = let
|
trampolineApps = let
|
||||||
apps = pkgs.buildEnv {
|
apps = pkgs.buildEnv {
|
||||||
name = "home-manager-applications";
|
name = "home-manager-applications";
|
||||||
|
@ -26,6 +26,13 @@
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
setSystemProxy = let networksetup = /usr/sbin/networksetup;
|
||||||
|
in lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
|
${networksetup} -setwebproxystate "Wi-fi" on
|
||||||
|
${networksetup} -setwebproxy "Wi-fi" 127.0.0.1 7890
|
||||||
|
${networksetup} -setwebproxystate "Ethernet" on
|
||||||
|
${networksetup} -setwebproxy "Ethernet" 127.0.0.1 7890
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
@ -63,13 +70,6 @@
|
||||||
nixd
|
nixd
|
||||||
nil
|
nil
|
||||||
];
|
];
|
||||||
|
|
||||||
sessionVariables = {
|
|
||||||
"https_proxy" = "http://127.0.0.1:7890";
|
|
||||||
"http_proxy" = "http://127.0.0.1:7890";
|
|
||||||
"socks_proxy" = "socks5://127.0.0.1:7890";
|
|
||||||
"all_proxy" = "socks5://127.0.0.1:7890";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# macOS don't have fontconfig
|
# macOS don't have fontconfig
|
||||||
|
|
Loading…
Reference in a new issue