Unified Nix configuration for NixOS (Linux) and nix-darwin (macOS).
- Nix with flakes enabled
- NixOS or nix-darwin
-
Install Lix:
curl -sSf -L https://install.lix.systems/lix | sh -s -- install -
Source the Nix environment:
. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh -
Apply the configuration:
nix --extra-experimental-features "nix-command flakes" run nix-darwin -- switch --flake ~/.config/nix-config#mac
sudo nixos-rebuild switch --flake ".#nixos" --accept-flake-config --impuresudo darwin-rebuild switch --flake ".#mac"nix fmt # Format code
nix flake check # Check flake
nix flake update # Update all inputs
nix flake lock --update-input <name> # Update specific input.
├── flake.nix
├── flakes/ # Flake-parts modules
├── home/ # Home Manager configurations (per-host)
│ ├── mac/
│ └── nixos/
├── hosts/ # System configurations (per-host)
│ ├── mac/
│ └── nixos/
├── lib/ # Utility functions
├── nvim/ # Neovim configuration (separate flake)
├── overlays/ # Nix package overlays
└── profiles/ # Host-independent shared configurations
├── home/ # Shared Home Manager modules
└── hosts/ # Shared host modules