Skip to content

cao7113/nix-mac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mac loves Nix

My nix-darwin + home-manager setup, using Determinate Nix to manage the macOS environment.

Overview

  • Use determinate-nix to install and manage the Nix version.
  • nix-mac is a public repository based on nix-darwin + home-manager, managing essential macOS software like zsh, postgresql, etc.
  • dot-sec is a private repository based on home-manager, managing private configuration data, including sops-nix, age, ssh, and more.
  • dot-sec is a standalone git repo, symlinked to ~/.sec as an optional home-manager submodule.
    • If ~/.sec exists, it will be deployed together with darwin-rebuild.
    • If it doesn't exist, it won't affect the nix-darwin deployment—just a missing notice will be shown.

Quick Start

  1. Install Determinate Nix.
  2. Clone the nix-mac repository.
  3. Run darwin-rebuild to switch configurations.
  4. Run iup for further initialization.

Setup

1. Prerequisites

  • Sign in to your Apple ID and ensure a stable internet connection.
  • Installing Homebrew and Xcode Command Line Tools may require significant downloads.

2. Install Determinate Nix

Recommended: use the Determinate Nix Installer:

curl -fsSL https://install.determinate.systems/nix | sh -s -- install

## need auth login???

For the pkg installer, see:

References:

Test the installation:

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#pkg2

3. Install nix-mac

# First time
mkdir -p ~/dev && cd ~/dev
git clone -v --depth=3 https://github.com/cao7113/nix-mac.git
cd nix-mac
sudo nix run "nix-darwin/nix-darwin-26.05#darwin-rebuild" -- switch --flake ".#mac" --show-trace --impure
# Then
iup

4. Install Xcode Command Line Tools

xcode-select --install
# Check the current path:
xcode-select -p

Notes & Recommendations

Homebrew

If your network is unstable, you can temporarily comment out the Homebrew section in flake.nix.

VSCode Extensions

It is recommended to install jnoortheen.nix-ide:

Flakehub CLI (fh)

nix profile add github:DeterminateSystems/fh
# Temporary shell install:
nix shell "https://flakehub.com/f/DeterminateSystems/fh/*"
nix run github:DeterminateSystems/fh -- --help
fh --version

Generate Initial SSH Key

gh auth login
gh ssh add ~/.ssh/id_ed25519.pub

GitHub API Rate Limits

Proxy Settings

If your network is unstable, you can use ShadowsocksNG:

export http_proxy=http://127.0.0.1:1087
export https_proxy=http://127.0.0.1:1087

References

About

Mac loves Nix

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages