mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-13 08:02:40 +02:00
feat: darwin
This commit is contained in:
+12
-6
@@ -23,9 +23,11 @@ let
|
|||||||
HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git";
|
HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git";
|
||||||
HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git";
|
HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git";
|
||||||
HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
|
HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
|
||||||
# local HTTP PROXY
|
};
|
||||||
HTTP_PROXY = "http://127.0.0.1:7890";
|
|
||||||
HTTPS_PROXY = "http://127.0.0.1:7890";
|
local_proxy_env = {
|
||||||
|
# HTTP_PROXY = "http://127.0.0.1:7890";
|
||||||
|
# HTTPS_PROXY = "http://127.0.0.1:7890";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
# Install packages from nix's official package repository.
|
# Install packages from nix's official package repository.
|
||||||
@@ -53,8 +55,12 @@ in {
|
|||||||
|
|
||||||
# Set environment variables for nix-darwin before run `brew bundle`.
|
# Set environment variables for nix-darwin before run `brew bundle`.
|
||||||
system.activationScripts.homebrew.text = let
|
system.activationScripts.homebrew.text = let
|
||||||
env_script = lib.attrsets.foldlAttrs (acc: name: value: acc + "\nexport ${name}=${value}") "" homebrew_mirror_env;
|
env_script =
|
||||||
in
|
lib.attrsets.foldlAttrs
|
||||||
|
(acc: name: value: acc + "\nexport ${name}=${value}")
|
||||||
|
""
|
||||||
|
(homebrew_mirror_env // local_proxy_env);
|
||||||
|
in
|
||||||
lib.mkBefore ''
|
lib.mkBefore ''
|
||||||
echo >&2 '${env_script}'
|
echo >&2 '${env_script}'
|
||||||
${env_script}
|
${env_script}
|
||||||
@@ -158,7 +164,7 @@ in {
|
|||||||
"sonic-pi" # music programming
|
"sonic-pi" # music programming
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
"mitmproxy" # HTTP/HTTPS traffic inspector
|
"mitmproxy" # HTTP/HTTPS traffic inspector
|
||||||
"insomnia" # REST client
|
"insomnia" # REST client
|
||||||
"wireshark" # network analyzer
|
"wireshark" # network analyzer
|
||||||
"jdk-mission-control" # Java Mission Control
|
"jdk-mission-control" # Java Mission Control
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
"b9902f2020c636aeda956a74b5ae11882d53e206d1aa50b3abe591a8144fa710" # nix-installer on harmonica
|
"b9902f2020c636aeda956a74b5ae11882d53e206d1aa50b3abe591a8144fa710" # nix-installer on harmonica
|
||||||
];
|
];
|
||||||
environment.etc."bashrc".knownSha256Hashes = [
|
environment.etc."bashrc".knownSha256Hashes = [
|
||||||
"204d2a960b3ab80e51748d3db0b63d940347ba71119ae6f14cccfec35da56cce" # nix-installer on harmonica
|
"53ab77cddb5c9aa2954efe42e9af0b8a2829f94dd31b6c33f8082ed194dcc0cb" # nix-installer on harmonica
|
||||||
"6ffdf5a198ffe73fbcd17def767f52093b42b29149d4a3e911b49ebcb9785101" # nix-installer on fern
|
"6ffdf5a198ffe73fbcd17def767f52093b42b29149d4a3e911b49ebcb9785101" # nix-installer on fern
|
||||||
];
|
];
|
||||||
environment.etc."zshenv".knownSha256Hashes = [
|
environment.etc."zshenv".knownSha256Hashes = [
|
||||||
"383a89c1f79c3bcfd2ff39a2b73b5103d0303161b3be9eac88fce83e0789f0b7" # nix-installer on harmonica
|
"bb96fe80a72ea9cd3291f09e4dc13a64e7db3b401f5889e43edc1fe34ed02d2c" # nix-installer on harmonica
|
||||||
"0c544e42afe7836de9ba933d93f46043b12f58ae484ff8cfb02716353f1dba5f" # nix-installer on fern
|
"0c544e42afe7836de9ba933d93f46043b12f58ae484ff8cfb02716353f1dba5f" # nix-installer on fern
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ HTTP_PROXY = "http://127.0.0.1:7890"
|
|||||||
pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
|
pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
|
||||||
|
|
||||||
# set http proxy
|
# set http proxy
|
||||||
pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
# pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
||||||
pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
# pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
||||||
|
|
||||||
# remove http proxy
|
# remove http proxy
|
||||||
# pl["EnvironmentVariables"].pop("HTTP_PROXY", None)
|
pl["EnvironmentVariables"].pop("HTTP_PROXY", None)
|
||||||
# pl["EnvironmentVariables"].pop("HTTPS_PROXY", None)
|
pl["EnvironmentVariables"].pop("HTTPS_PROXY", None)
|
||||||
|
|
||||||
os.chmod(NIX_DAEMON_PLIST, 0o644)
|
os.chmod(NIX_DAEMON_PLIST, 0o644)
|
||||||
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(pl))
|
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(pl))
|
||||||
|
|||||||
Reference in New Issue
Block a user