Multi-platform nix configuration supporting both macOS (darwin) and Linux (NixOS) systems.
symfoo-nix/
├── flake.nix # Main flake with both darwinConfigurations and nixosConfigurations
├── hosts/
│ ├── mac/
│ │ └── configuration.nix # macOS-specific configuration
│ └── linux/
│ └── configuration.nix # Linux-specific configuration
└── modules/
├── shared/ # Shared modules for both platforms
│ ├── packages.nix # Common packages (neovim, tmux)
│ ├── fonts.nix # Common fonts
│ └── nix-settings.nix # Common nix settings
├── darwin/ # Darwin-specific modules
│ └── spotlight-applications.nix
└── nix-path-priority.nix # PATH priority (works on both)
Install Lix on macOS or Ubuntu using a single command:
curl -sSf -L https://install.lix.systems/lix | sh -s -- installThis will install a complete Lix setup on your system.
Build the darwin configuration without applying it:
nix build .#macOr using darwin-rebuild:
darwin-rebuild build --flake '.#mac'Apply the configuration to your system (requires sudo for system activation):
sudo nix --extra-experimental-features "nix-command flakes" run nix-darwin -- switch --flake '.#mac'Or if darwin-rebuild is available in your PATH:
darwin-rebuild switch --flake '.#mac'Build the NixOS configuration without applying it:
nix build .#nixosConfigurations.linux.config.system.build.toplevelOr using nixos-rebuild:
sudo nixos-rebuild build --flake '.#linux'Apply the configuration to your system:
sudo nixos-rebuild switch --flake '.#linux'The following modules are shared between both platforms:
- Packages: neovim, tmux
- Fonts: Fira Code, JetBrains Mono, Droid Sans Mono
- Nix Settings: Flakes enabled, experimental features
- Homebrew management via nix-homebrew
- Spotlight integration for nix-installed applications
- PATH priority to ensure nix packages take precedence
- macOS-specific packages: alacritty, obsidian, mkalias
- NixOS system configuration
- Linux-specific packages (add as needed)
- The quotes around
'.#mac'or'.#linux'are required in zsh to prevent glob expansion - The
--extra-experimental-featuresflag must be passed tonixbeforerunwhen usingnix run - All module files must be git-tracked for nix flakes to include them