-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathhomebrew-mirror.nix
25 lines (24 loc) · 959 Bytes
/
homebrew-mirror.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ lib, ... }:
let
# Homebrew Mirror
homebrew_mirror_env = {
HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api";
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles";
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_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
};
in
{
# Set variables for you to manually install homebrew packages.
environment.variables = homebrew_mirror_env;
# Set environment variables for nix-darwin before run `brew bundle`.
system.activationScripts.homebrew.text =
let
env_script = lib.attrsets.foldlAttrs (acc: name: value: acc + "\nexport ${name}=${value}") "" homebrew_mirror_env;
in
lib.mkBefore ''
echo >&2 '${env_script}'
${env_script}
'';
}