This commit is contained in:
Guanran Wang 2023-10-10 17:49:57 +08:00
commit f1180fd4a5
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8
5 changed files with 39 additions and 11 deletions

View file

@ -3,5 +3,6 @@
{ {
imports = [ imports = [
./dns.nix ./dns.nix
./proxy.nix
]; ];
} }

View 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 = {
"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";
};
environment.etc."clash-meta/metacubexd".source = ../../users/guanranwang/home-manager/common/dotfiles/config/clash/metacubexd;
}

View file

@ -15,7 +15,7 @@
"alt-tab" "alt-tab"
"altserver" "altserver"
"balenaetcher" "balenaetcher"
"clashx" #"clashx"
"opencore-patcher" "opencore-patcher"
#"element" #"element"

View file

@ -48,7 +48,7 @@
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./darwin # Entrypoint ./darwin # Entrypoint
./machines/darwin/imac-2017.nix # Hardware-specific configurations ./machines/darwin/imac-2017 # Hardware-specific configurations
# Machine-specific configurations (does such stuff even exist on nix-darwin) # Machine-specific configurations (does such stuff even exist on nix-darwin)
./users/guanranwang/darwin.nix # User-specific configurations ./users/guanranwang/darwin.nix # User-specific configurations
./flakes/darwin/home-manager.nix # Flakes ./flakes/darwin/home-manager.nix # Flakes

View file

@ -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 = {
"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";
};
}; };
# macOS don't have fontconfig # macOS don't have fontconfig