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 = [
|
||||
./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"
|
||||
"altserver"
|
||||
"balenaetcher"
|
||||
"clashx"
|
||||
#"clashx"
|
||||
"opencore-patcher"
|
||||
|
||||
#"element"
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
username = "guanranwang";
|
||||
homeDirectory = "/Users/guanranwang";
|
||||
|
||||
activation = {
|
||||
# Workaround for spotlight indexing
|
||||
# https://github.com/nix-community/home-manager/issues/1341#issuecomment-1705731962_
|
||||
activation = {
|
||||
trampolineApps = let
|
||||
apps = pkgs.buildEnv {
|
||||
name = "home-manager-applications";
|
||||
|
@ -26,6 +26,13 @@
|
|||
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; [
|
||||
|
@ -63,13 +70,6 @@
|
|||
nixd
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue