This repo manages both Darwin (nix-darwin + home-manager) and NixOS systems.
Always work from ~/nixos root directory.
- Aim for cohesive configuration across systems
- Avoid unnecessary differentiation
- Only differentiate when required (Darwin-specific CLI tools, NixOS system packages)
- Different syntaxes (Hjem vs home-manager): aim for configuration similarity, not code sharing
- Check
flake.nixfor inputs and shared configuration strategies
System-agnostic option definitions and reusable modules shared across Darwin and NixOS.
- Examples: zsh, zellij, shell functions
- Rule: Use if the tool/concept exists identically on both systems
NixOS user-level implementations using hjem syntax.
- Examples: zsh config specific to NixOS, user environment setup
NixOS system-level configuration.
- System packages and kernel-level configuration
- Examples: niri (Wayland compositor, Linux-only), system services
Darwin user-level implementations using home-manager syntax.
- Examples: zsh config specific to Darwin, user environment setup
Darwin system-level configuration using nix-darwin.
- System packages and macOS-specific setup
- Examples: raycast (macOS spotlight alternative, macOS-only)
- raycast: Darwin-only macOS app, goes in darwin/system
- niri: Linux-only Wayland compositor, goes in nixos/system
- Anything with system-specific syscalls or platform-only binaries
default.nix files should be import-only. They should only contain imports of other modules, no inline configuration.
# CORRECT - import only
{
foo = import ./foo.nix;
bar = import ./bar.nix;
}
# WRONG - inline configuration
{
foo = import ./foo.nix;
someOption = "value"; # Don't do this
}Uses nix-darwin and home-manager.
git add → alejandra . → nh darwin switch → TEST → git commit && push
CRITICAL: Only commit after successful switch and user testing.
Uses hjem. Clone external repos to ~/nixos/tmp/.
IMPORTANT: All packages are system-level (environment.systemPackages), NOT user-level.
git add → alejandra . → nh os switch --dry → nh os switch → TEST → git commit && push
CRITICAL: Only commit after successful switch and user testing.
files."path" = { generator = lib.generators.toFormat {}; value = {}; };usr is aliased to hjem.users.${config.user.name} (defined in nixos/user/core/user-config.nix:9).
Use usr.files = { ... } as shorthand instead of hjem.users.${name}.files = { ... }.
NEVER attempt git commit until:
alejandra .completes without errorsnh os switch --drysucceeds (NixOS) ORnh darwin switchsucceeds (Darwin)nh os switchsucceeds (NixOS only, after dry run passes)- Manual testing confirms expected behavior
If any step fails, fix the issue before committing.