My nix-darwin + home-manager setup and macOS recipies.
# init setup
curl -fsSL https://raw.githubusercontent.com/cao7113/nix-mac/main/setup.zsh | command zsh -s
# try below when blocked
curl -fsSL https://ghproxy.net/https://raw.githubusercontent.com/cao7113/nix-mac/main/setup.zsh | command zsh -s
curl -fsSL https://cdn.jsdelivr.net/gh/cao7113/nix-mac@main/setup.zsh | command zsh -s
curl -fsSL https://gitmirror.com/https://raw.githubusercontent.com/cao7113/nix-mac/main/setup.zsh | command zsh -s
# 上面的会使用默认代理。。。如需要配置代理,需要
[[ ! -f /tmp/mac.sh ]] && curl -fsSL https://ghproxy.net/https://raw.githubusercontent.com/cao7113/nix-mac/main/setup.zsh > /tmp/mac.sh && chmod +x /tmp/mac.sh && /tmp/mac.sh
# /tmp/mac.sh
# daily use
mdp # iup
- Use
nix/installer/official-installerto install and manage the Nix version. nix-macis a public repository based onnix-darwin+home-manager, managing essential macOS software likezsh,postgresql, etc.dot-secis a private repository based onhome-manager, managing private configuration data, includingsops-nix,age,ssh, and more.dot-secis a standalone git repo, symlinked to~/.secas an optionalhome-managersubmodule.- If
~/.secexists, it will be deployed together withdarwin-rebuild. - If it doesn't exist, it won't affect the
nix-darwindeployment—just a missing notice will be shown.
- If
main.zshis the zsh rc entry file
nix shell "nixpkgs#hello"
nix shell "nixpkgs#hello" --command hello --version
nix run "nixpkgs#hello" -- --version
nix shell "github:NixOS/nixpkgs/nixos-unstable#hello"
nix run "nixpkgs#cowsay" -- "Hello"
# nix shell nixpkgs#pkg1 nixpkgs#pkg2proxy host: 192.168.64.1
gh auth login
gh ssh add ~/.ssh/id_ed25519.pubIf your network is unstable, use ShadowsocksNG:
export http_proxy=http://127.0.0.1:1087
export https_proxy=http://127.0.0.1:1087- https://github.com/nix-community/home-manager
- https://home-manager-options.extranix.com/?query=direnv&release=release-26.05
- https://github.com/nix-darwin/nix-darwin
- https://nix-darwin.github.io/nix-darwin/manual/index.html
- https://callistaenterprise.se/blogg/teknik/2025/05/28/nix-darwin/
- https://github.com/HestHub/nixos
- https://nix.dev/manual/nix/2.28/introduction.html