From f6c8d8026721d2b790fc0a0f65a5e3310f1dcf0b Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Thu, 15 Jun 2023 07:58:55 +0800 Subject: [PATCH] chore: separate machines --- flake.nix | 20 +++++++++++++- .../daemons/adguard-home-with-proxy.nix | 26 ++++++++++++++++++ modules/yqrashawn/darwin/daemons/default.nix | 7 +---- .../darwin/daemons/tailscale-utun.nix | 18 ++++++++++++ modules/yqrashawn/darwin/default.nix | 1 - .../yqrashawn/home-manager/dotfiles/ssh.gpg | Bin 1747 -> 1758 bytes modules/yqrashawn/mbp.nix | 6 ++++ modules/yqrashawn/mini.nix | 6 ++++ modules/yqrashawn/studio.nix | 3 ++ 9 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 modules/yqrashawn/darwin/daemons/adguard-home-with-proxy.nix create mode 100644 modules/yqrashawn/darwin/daemons/tailscale-utun.nix create mode 100644 modules/yqrashawn/mbp.nix create mode 100644 modules/yqrashawn/mini.nix create mode 100644 modules/yqrashawn/studio.nix diff --git a/flake.nix b/flake.nix index 3c5db4e51..d66506e04 100644 --- a/flake.nix +++ b/flake.nix @@ -289,8 +289,26 @@ system = "aarch64-darwin"; extraModules = [ ./profiles/yqrashawn.nix - ./modules/yqrashawn/darwin/daemons/tailscale.nix ./modules/yqrashawn/darwin/apps.nix + ./modules/yqrashawn/mini.nix + { homebrew.brewPrefix = "/opt/homebrew/bin"; } + ]; + }; + studio = mkDarwinConfig { + system = "aarch64-darwin"; + extraModules = [ + ./profiles/yqrashawn.nix + ./modules/yqrashawn/darwin/apps.nix + ./modules/yqrashawn/studio.nix + { homebrew.brewPrefix = "/opt/homebrew/bin"; } + ]; + }; + mbp = mkDarwinConfig { + system = "aarch64-darwin"; + extraModules = [ + ./profiles/yqrashawn.nix + ./modules/yqrashawn/darwin/apps.nix + ./modules/yqrashawn/mbp.nix { homebrew.brewPrefix = "/opt/homebrew/bin"; } ]; }; diff --git a/modules/yqrashawn/darwin/daemons/adguard-home-with-proxy.nix b/modules/yqrashawn/darwin/daemons/adguard-home-with-proxy.nix new file mode 100644 index 000000000..5d70e5706 --- /dev/null +++ b/modules/yqrashawn/darwin/daemons/adguard-home-with-proxy.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +{ + launchd.daemons.adguardhome = { + serviceConfig = { + Label = "com.adguard.adguardhome"; + EnvironmentVariables = { + http_proxy = "http://127.0.0.1:6152"; + https_proxy = "http://127.0.0.1:6152"; + all_proxy = "socks5://127.0.0.1:6153"; + HTTP_PROXY = "http://127.0.0.1:6152"; + HTTPS_PROXY = "http://127.0.0.1:6152"; + ALL_PROXY = "socks5://127.0.0.1:6153"; + }; + ProgramArguments = [ + "/bin/sh" + "-c" + "/bin/wait4path ${pkgs.adguardhome} && ${pkgs.adguardhome}/bin/adguardhome --config /Users/${config.user.name}/.nixpkgs/modules/yqrashawn/home-manager/dotfiles/AdguardHome.yaml" + ]; + RunAtLoad = true; + KeepAlive = true; + StandardErrorPath = "/tmp/adguardhome-stderr.log"; + StandardOutPath = "/tmp/adguardhome-stdout.log"; + }; + }; +} diff --git a/modules/yqrashawn/darwin/daemons/default.nix b/modules/yqrashawn/darwin/daemons/default.nix index 619dea6f1..056abeeb8 100644 --- a/modules/yqrashawn/darwin/daemons/default.nix +++ b/modules/yqrashawn/darwin/daemons/default.nix @@ -1,8 +1,3 @@ { config, lib, pkgs, ... }: { - imports = [ - ./set-path.nix - ./limit-max.nix - # ./tailscale.nix - ./adguard-home.nix - ]; + imports = [ ./set-path.nix ./limit-max.nix ./adguard-home.nix ]; } diff --git a/modules/yqrashawn/darwin/daemons/tailscale-utun.nix b/modules/yqrashawn/darwin/daemons/tailscale-utun.nix new file mode 100644 index 000000000..da5f94349 --- /dev/null +++ b/modules/yqrashawn/darwin/daemons/tailscale-utun.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: + +{ + launchd.daemons.tailscaled = { + serviceConfig = { + Label = "com.tailscale.tailscaled"; + ProgramArguments = [ + "/bin/sh" + "-c" + "/bin/wait4path ${pkgs.tailscale} && ${pkgs.tailscale}/bin/tailscaled -tun utun -statedir /Users/${config.user.name}/tailscale" + ]; + RunAtLoad = true; + KeepAlive = true; + StandardErrorPath = "/tmp/tailscaled-stderr.log"; + StandardOutPath = "/tmp/tailscaled-stdout.log"; + }; + }; +} diff --git a/modules/yqrashawn/darwin/default.nix b/modules/yqrashawn/darwin/default.nix index 4db97585d..c3fa259ac 100644 --- a/modules/yqrashawn/darwin/default.nix +++ b/modules/yqrashawn/darwin/default.nix @@ -5,6 +5,5 @@ ./brew.nix ./preferences.nix ./display-manager.nix - # ./tailscale.nix ]; } diff --git a/modules/yqrashawn/home-manager/dotfiles/ssh.gpg b/modules/yqrashawn/home-manager/dotfiles/ssh.gpg index 6c4b4803fd0b61d44e0e62b77203f836ecb89152..92c3abc91aa3d777e681a65f372471e56651aa29 100644 GIT binary patch literal 1758 zcmV<41|j){0t^Gy_N59o0J~QK5CF|}fm%8S%$r_oBAG~!MZ8p}t@34SKynLWLu>__ zLElJDe)N%Ly4WhATa|tyJQmL!^xKO6)+{BhRd4gfzt7xMqB;cpZ+vblcS-qEv(KQ7 z7J@`#;-IaZOucNq1@&RG$(2g#B z2~GUen`cc@*V zZ6@ntz77Kz9qNJou3*yY0ZDK9-R6~kNF?@{?dUn+AimWdu2y?(TvD15M_lUcd;(aj zPND2(w}dD7vR}hLYIh24vpF((L}c<5gstj)ltFv%Pue&o0+Ezw3PplK9DKs-&JRdqyB9WbIn znIip=#fuczo08xk;5-o!x$rnMZOXvEROwSfo(H=1RT??f^wS8i0N8e%6oA}h9HhT5 z!ch<2v%mFws!bF;)-L((j}@2FL(v&T?;7Z(_&F&^?+D3=ZB#9mDUV_qUi|tcm{o-m z^-$LO>(+5ivQ{gW=kPGZQa~WdQkmf$*L)%-)0}`htKyaG@{Y6DolsYqDl8J<=soNx zHzSWIbzhy8dHu$S>iyJh0PiwfBQ+Y9Wo5M3sZ;sK z0efW1d+IjsA-g4sqZO70dng z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JK$fL-xVdb>_g0kw~M3` zp@jj2d#Q0CA&ouzuQ#pkTHf_f_J1Qlck=OMZ`x++PHTPN67rbG>3&kV^&D1w|nCf{3+~ubrr3Yt}BdnmF89RXIYrtY?%nj-P9mo zG*#>vZ*zdKxeX;4ck~W*o`JK`wnVR!yVzwqIOrQU?`C}5Qz^%Pdx)3wW8nP$K__TW zv_SyZl`a;_*yt*NQvYz_y~f~)nZgolKS5BYNl#(q}?=dfX~_Pg$0TMmz0od1d{r*JqPg!c^bKo>R~# pnL_2s3t{>@_F3Mo}%yKEr!O#<>Xd(ar diff --git a/modules/yqrashawn/mbp.nix b/modules/yqrashawn/mbp.nix new file mode 100644 index 000000000..d271e22b4 --- /dev/null +++ b/modules/yqrashawn/mbp.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, ... }: { + imports = [ + ./darwin/daemons/tailscale.nix + ./darwin/daemons/adguard-home-with-proxy.nix + ]; +} diff --git a/modules/yqrashawn/mini.nix b/modules/yqrashawn/mini.nix new file mode 100644 index 000000000..d271e22b4 --- /dev/null +++ b/modules/yqrashawn/mini.nix @@ -0,0 +1,6 @@ +{ config, lib, pkgs, ... }: { + imports = [ + ./darwin/daemons/tailscale.nix + ./darwin/daemons/adguard-home-with-proxy.nix + ]; +} diff --git a/modules/yqrashawn/studio.nix b/modules/yqrashawn/studio.nix new file mode 100644 index 000000000..f4d1ee6aa --- /dev/null +++ b/modules/yqrashawn/studio.nix @@ -0,0 +1,3 @@ +{ config, lib, pkgs, ... }: { + imports = [ ./darwin/daemons/tailscale-utun.nix ]; +}