mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-01-11 20:40:24 +01:00
* feat: comment out nixpkgs-unstable, we use unstable by default Signed-off-by: Ryan Yin <xiaoyin_c@qq.com> * fix: typo... --------- Signed-off-by: Ryan Yin <xiaoyin_c@qq.com>
215 lines
7.4 KiB
Nix
215 lines
7.4 KiB
Nix
{
|
||
config,
|
||
lib,
|
||
pkgs,
|
||
...
|
||
}:
|
||
##########################################################################
|
||
#
|
||
# Install all apps and packages here.
|
||
#
|
||
# NOTE: Your can find all available options in:
|
||
# https://daiderd.com/nix-darwin/manual/index.html
|
||
#
|
||
# NOTE:To remove the uninstalled APPs icon from Launchpad:
|
||
# 1. `sudo nix store gc --debug` & `sudo nix-collect-garbage --delete-old`
|
||
# 2. click on the uninstalled APP's icon in Launchpad, it will show a question mark
|
||
# 3. if the app starts normally:
|
||
# 1. right click on the running app's icon in Dock, select "Options" -> "Show in Finder" and delete it
|
||
# 4. hold down the Option key, a `x` button will appear on the icon, click it to remove the icon
|
||
#
|
||
# 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 = {
|
||
# tuna mirror
|
||
# 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";
|
||
|
||
# bfsu mirror
|
||
HOMEBREW_API_DOMAIN = "https://mirrors.bfsu.edu.cn/homebrew-bottles/api";
|
||
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.bfsu.edu.cn/homebrew-bottles";
|
||
HOMEBREW_BREW_GIT_REMOTE = "https://mirrors.bfsu.edu.cn/git/homebrew/brew.git";
|
||
HOMEBREW_CORE_GIT_REMOTE = "https://mirrors.bfsu.edu.cn/git/homebrew/homebrew-core.git";
|
||
HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
|
||
|
||
# nju mirror
|
||
# HOMEBREW_API_DOMAIN = "https://mirror.nju.edu.cn/homebrew-bottles/api";
|
||
# HOMEBREW_BOTTLE_DOMAIN = "https://mirror.nju.edu.cn/homebrew-bottles";
|
||
# HOMEBREW_BREW_GIT_REMOTE = "https://mirror.nju.edu.cn/git/homebrew/brew.git";
|
||
# HOMEBREW_CORE_GIT_REMOTE = "https://mirror.nju.edu.cn/git/homebrew/homebrew-core.git";
|
||
# HOMEBREW_PIP_INDEX_URL = "https://pypi.tuna.tsinghua.edu.cn/simple";
|
||
};
|
||
|
||
local_proxy_env = {
|
||
# HTTP_PROXY = "http://127.0.0.1:7890";
|
||
# HTTPS_PROXY = "http://127.0.0.1:7890";
|
||
};
|
||
|
||
homebrew_env_script = lib.attrsets.foldlAttrs (
|
||
acc: name: value:
|
||
acc + "\nexport ${name}=${value}"
|
||
) "" (homebrew_mirror_env // local_proxy_env);
|
||
in
|
||
{
|
||
# 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.
|
||
# But on macOS, it's less stable than homebrew.
|
||
#
|
||
# Related Discussion: https://discourse.nixos.org/t/darwin-again/29331
|
||
environment.systemPackages = with pkgs; [
|
||
neovim
|
||
git
|
||
nushell # my custom shell
|
||
gnugrep # replacee macos's grep
|
||
gnutar # replacee macos's tar
|
||
|
||
# darwin only apps
|
||
utm # virtual machine
|
||
];
|
||
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"
|
||
];
|
||
}
|
||
# 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 = lib.mkBefore ''
|
||
echo >&2 '${homebrew_env_script}'
|
||
${homebrew_env_script}
|
||
'';
|
||
|
||
# Create /etc/zshrc that loads the nix-darwin environment.
|
||
# this is required if you want to use darwin's default shell - zsh
|
||
programs.zsh.enable = true;
|
||
environment.shells = [
|
||
pkgs.zsh
|
||
pkgs.nushell # my custom shell
|
||
];
|
||
|
||
# homebrew need to be installed manually, see https://brew.sh
|
||
# https://github.com/LnL7/nix-darwin/blob/master/modules/homebrew.nix
|
||
homebrew = {
|
||
enable = true; # disable homebrew for fast deploy
|
||
|
||
onActivation = {
|
||
autoUpdate = true; # Fetch the newest stable branch of Homebrew's git repo
|
||
upgrade = true; # Upgrade outdated casks, formulae, and App Store apps
|
||
# 'zap': uninstalls all formulae(and related files) not listed in the generated Brewfile
|
||
cleanup = "zap";
|
||
};
|
||
|
||
# Applications to install from Mac App Store using mas.
|
||
# You need to install all these Apps manually first so that your apple account have records for them.
|
||
# otherwise Apple Store will refuse to install them.
|
||
# For details, see https://github.com/mas-cli/mas
|
||
masApps = {
|
||
# Xcode = 497799835;
|
||
Wechat = 836500024;
|
||
};
|
||
|
||
taps = [
|
||
"hashicorp/tap"
|
||
"nikitabobko/tap" # aerospace - an i3-like tiling window manager for macOS
|
||
"FelixKratz/formulae" # janky borders - highlight active window borders
|
||
];
|
||
|
||
brews = [
|
||
# `brew install`
|
||
"wget" # download tool
|
||
"curl" # no not install curl via nixpkgs, it's not working well on macOS!
|
||
"aria2" # download tool
|
||
"wireguard-tools" # wireguard
|
||
|
||
# Usage:
|
||
# https://github.com/tailscale/tailscale/wiki/Tailscaled-on-macOS#run-the-tailscaled-daemon
|
||
# 1. `sudo tailscaled install-system-daemon`
|
||
# 2. `tailscale up --accept-routes`
|
||
# "tailscale" # tailscale cli version
|
||
|
||
# https://github.com/rgcr/m-cli
|
||
"m-cli" # Swiss Army Knife for macOS
|
||
"proxychains-ng"
|
||
|
||
# commands like `gsed` `gtar` are required by some tools
|
||
"gnu-sed"
|
||
"gnu-tar"
|
||
|
||
# misc that nix do not have cache for.
|
||
"git-trim"
|
||
"terraform"
|
||
"terraformer"
|
||
];
|
||
|
||
# `brew install --cask`
|
||
casks = [
|
||
"squirrel-app" # input method for Chinese, rime-squirrel
|
||
"firefox"
|
||
"google-chrome"
|
||
|
||
# code editor
|
||
"visual-studio-code"
|
||
# "zed"
|
||
"cursor" # cursor ai editor
|
||
|
||
"aerospace" # an i3-like tiling window manager for macOS
|
||
"ghostty" # terminal emulator
|
||
|
||
# https://joplinapp.org/help/
|
||
"joplin" # note taking app
|
||
|
||
"tailscale-app" # tailscale macos app (with gui)
|
||
"netbirdio/tap/netbird-ui" # netbird gui app
|
||
|
||
# AI
|
||
"lm-studio"
|
||
|
||
# IM & audio & remote desktop & meeting
|
||
"telegram"
|
||
"qq"
|
||
"qqmusic"
|
||
# "discord" # update too frequently, use the web version instead
|
||
"microsoft-remote-desktop"
|
||
# "moonlight" # remote desktop client
|
||
# "rustdesk" # meeting
|
||
# "tencent-meeting"
|
||
"zoom" # meeting
|
||
|
||
# Misc
|
||
# "shadowsocksx-ng" # proxy tool
|
||
"iina" # video player
|
||
# "raycast" # (HotKey: alt/option + space)search, calculate and run scripts(with many plugins)
|
||
"stats" # beautiful system status monitor in menu bar
|
||
"jordanbaird-ice" # Powerful menu bar manager for macOS
|
||
|
||
# "reaper" # audio editor
|
||
# "sonic-pi" # music programming
|
||
# "tencent-lemon" # macOS cleaner
|
||
"neteasemusic" # music
|
||
"blender@lts" # 3D creation suite
|
||
"clash-verge-rev" # the same as mihomo-party
|
||
|
||
# Development
|
||
"mitmproxy" # HTTP/HTTPS traffic inspector
|
||
"insomnia" # REST client
|
||
"wireshark-app" # network analyzer
|
||
# "jdk-mission-control" # Java Mission Control
|
||
# "google-cloud-sdk" # Google Cloud SDK
|
||
"miniforge" # Miniconda's community-driven distribution
|
||
|
||
# Setup macfuse: https://github.com/macfuse/macfuse/wiki/Getting-Started
|
||
"macfuse" # for rclone to mount a fuse filesystem
|
||
];
|
||
};
|
||
}
|