mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 10:18:37 +02:00
feat: darwin - homebrew mirror, replace iglance with stats
This commit is contained in:
@@ -1,19 +1,33 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
config,
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}:
|
||||||
##########################################################################
|
##########################################################################
|
||||||
#
|
#
|
||||||
# Install all apps and packages here.
|
# Install all apps and packages here.
|
||||||
#
|
#
|
||||||
# NOTE: Your can find all available options in:
|
# NOTE: Your can find all available options in:
|
||||||
# https://daiderd.com/nix-darwin/manual/index.html
|
# https://daiderd.com/nix-darwin/manual/index.html
|
||||||
#
|
#
|
||||||
# TODO Fell free to modify this file to fit your needs.
|
# TODO Fell free to modify this file to fit your needs.
|
||||||
#
|
#
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
let
|
||||||
|
# Homebrew Mirror
|
||||||
|
# NOTE: is only useful when you run `brew install` manually! (not via nix-darwin)
|
||||||
|
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";
|
||||||
|
# local HTTP PROXY
|
||||||
|
HTTP_PROXY = "http://127.0.0.1:7890";
|
||||||
|
HTTPS_PROXY = "http://127.0.0.1:7890";
|
||||||
|
};
|
||||||
|
in {
|
||||||
# Install packages from nix's official package repository.
|
# Install packages from nix's official package repository.
|
||||||
#
|
#
|
||||||
# The packages installed here are available to all users, and are reproducible across machines, and are rollbackable.
|
# The packages installed here are available to all users, and are reproducible across machines, and are rollbackable.
|
||||||
@@ -27,12 +41,24 @@
|
|||||||
gnugrep # replacee macos's grep
|
gnugrep # replacee macos's grep
|
||||||
gnutar # replacee macos's tar
|
gnutar # replacee macos's tar
|
||||||
];
|
];
|
||||||
environment.variables = {
|
environment.variables =
|
||||||
# Fix https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues
|
{
|
||||||
TERMINFO_DIRS = map (path: path + "/share/terminfo") config.environment.profiles ++ ["/usr/share/terminfo"];
|
# Fix https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues
|
||||||
|
TERMINFO_DIRS = map (path: path + "/share/terminfo") config.environment.profiles ++ ["/usr/share/terminfo"];
|
||||||
|
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
};
|
}
|
||||||
|
# Set variables for you to manually install homebrew packages.
|
||||||
|
// 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}
|
||||||
|
'';
|
||||||
|
|
||||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||||
# this is required if you want to use darwin's default shell - zsh
|
# this is required if you want to use darwin's default shell - zsh
|
||||||
@@ -42,19 +68,10 @@
|
|||||||
pkgs.nushell # my custom shell
|
pkgs.nushell # my custom shell
|
||||||
];
|
];
|
||||||
|
|
||||||
# Homebrew Mirror
|
|
||||||
# NOTE: is only useful when you run `brew install` manually! (not via nix-darwin)
|
|
||||||
environment.variables = {
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
|
|
||||||
# homebrew need to be installed manually, see https://brew.sh
|
# homebrew need to be installed manually, see https://brew.sh
|
||||||
|
# https://github.com/LnL7/nix-darwin/blob/master/modules/homebrew.nix
|
||||||
homebrew = {
|
homebrew = {
|
||||||
enable = false;
|
enable = true;
|
||||||
|
|
||||||
onActivation = {
|
onActivation = {
|
||||||
autoUpdate = false;
|
autoUpdate = false;
|
||||||
@@ -83,7 +100,6 @@
|
|||||||
"homebrew/cask-versions"
|
"homebrew/cask-versions"
|
||||||
|
|
||||||
"hashicorp/tap"
|
"hashicorp/tap"
|
||||||
"pulumi/tap"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
brews = [
|
brews = [
|
||||||
@@ -135,10 +151,9 @@
|
|||||||
# "anki"
|
# "anki"
|
||||||
"shadowsocksx-ng" # proxy tool
|
"shadowsocksx-ng" # proxy tool
|
||||||
"iina" # video player
|
"iina" # video player
|
||||||
"openinterminal-lite" # open current folder in terminal
|
|
||||||
"syncthing" # file sync
|
"syncthing" # file sync
|
||||||
"raycast" # (HotKey: alt/option + space)search, caculate and run scripts(with many plugins)
|
"raycast" # (HotKey: alt/option + space)search, caculate and run scripts(with many plugins)
|
||||||
"iglance" # beautiful system monitor
|
"stats" # beautiful system status monitor in menu bar
|
||||||
"eudic" # 欧路词典
|
"eudic" # 欧路词典
|
||||||
# "reaper" # audio editor
|
# "reaper" # audio editor
|
||||||
"sonic-pi" # music programming
|
"sonic-pi" # music programming
|
||||||
|
|||||||
@@ -59,7 +59,10 @@
|
|||||||
# `defaults read NSGlobalDomain "xxx"`
|
# `defaults read NSGlobalDomain "xxx"`
|
||||||
"com.apple.swipescrolldirection" = true; # enable natural scrolling(default to true)
|
"com.apple.swipescrolldirection" = true; # enable natural scrolling(default to true)
|
||||||
"com.apple.sound.beep.feedback" = 0; # disable beep sound when pressing volume up/down key
|
"com.apple.sound.beep.feedback" = 0; # disable beep sound when pressing volume up/down key
|
||||||
|
|
||||||
|
# Appearance
|
||||||
AppleInterfaceStyle = "Dark"; # dark mode
|
AppleInterfaceStyle = "Dark"; # dark mode
|
||||||
|
|
||||||
AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control.
|
AppleKeyboardUIMode = 3; # Mode 3 enables full keyboard control.
|
||||||
ApplePressAndHoldEnabled = true; # enable press and hold
|
ApplePressAndHoldEnabled = true; # enable press and hold
|
||||||
|
|
||||||
@@ -129,6 +132,9 @@
|
|||||||
# keyboard settings is not very useful on macOS
|
# keyboard settings is not very useful on macOS
|
||||||
# the most important thing is to remap option key to alt key globally,
|
# the most important thing is to remap option key to alt key globally,
|
||||||
# but it's not supported by macOS yet.
|
# but it's not supported by macOS yet.
|
||||||
|
#
|
||||||
|
# To avoid conflicts with neovim, disable ctrl + up/down/left/right to switch spaces in:
|
||||||
|
# [System Preferences] -> [Keyboard] -> [Keyboard Shortcuts] -> [Mission Control]
|
||||||
keyboard = {
|
keyboard = {
|
||||||
enableKeyMapping = true; # enable key mapping so that we can use `option` as `control`
|
enableKeyMapping = true; # enable key mapping so that we can use `option` as `control`
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,9 @@ pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
|
|||||||
pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
||||||
pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
||||||
|
|
||||||
# Homebrew Mirror
|
# remove http proxy
|
||||||
pl["EnvironmentVariables"].update({
|
# pl["EnvironmentVariables"].pop("HTTP_PROXY", None)
|
||||||
"HOMEBREW_API_DOMAIN": "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api",
|
# pl["EnvironmentVariables"].pop("HTTPS_PROXY", None)
|
||||||
"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",
|
|
||||||
})
|
|
||||||
|
|
||||||
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))
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ with args; let
|
|||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
# macOS's configuration, for work.
|
# macOS's configuration
|
||||||
darwinConfigurations = {
|
darwinConfigurations = {
|
||||||
harmonica =
|
harmonica =
|
||||||
macosSystem (x64_args
|
macosSystem (x64_args
|
||||||
|
|||||||
Reference in New Issue
Block a user