A clean, modular Nix configuration supporting both NixOS and nix-darwin with Home Manager integration.
This configuration uses a layered architecture with shared components and platform-specific overrides:
nix-rework/
├── flake.nix # Main flake entry point
├── shared/ # Cross-platform components
├── linux/ # Linux/NixOS specific
├── darwin/ # macOS/nix-darwin specific
└── systems/ # Machine-specific configs
shared/
├── home-manager/ # User-level configs
│ ├── cli-tools.nix # CLI utilities (fzf, ripgrep, direnv, yazi)
│ ├── development.nix # Programming languages & tools
│ ├── git.nix # Git configuration
│ ├── nixvim/ # Nixvim configuration directory
│ │ ├── default.nix # Main nixvim configuration
│ │ ├── keymaps.nix # Key mappings
│ │ └── plugins.nix # Plugin configurations
│ ├── zsh.nix # Zsh with oh-my-zsh and starship
│ ├── tmux.nix # Tmux configuration
│ ├── terminals.nix # Terminal emulators (ghostty)
│ ├── zed.nix # Zed editor
│ ├── browser.nix # Web browser (Chrome)
│ ├── discord.nix # Discord
│ ├── docker.nix # Docker tools (lazydocker)
│ ├── thunderbird.nix # Email client
│ └── core.nix # Basic Home Manager setup
└── system/ # System-level configs
├── nix.nix # Core Nix settings
├── fonts.nix # Font packages
├── shell.nix # System shell config
└── stylix.nix # Theming with Stylix
linux/
├── default.nix # Linux platform defaults
└── modules/
├── system/ # System-level Linux configs
│ ├── gaming.nix # Steam and gaming setup
│ ├── polybar.nix # Status bar (shared across WMs)
│ └── rofi.nix # Application launcher (shared)
├── programs/ # User programs (Linux-specific)
│ ├── desktop-apps.nix # Desktop applications
│ └── gaming.nix # User gaming tools (lutris)
└── window-managers/ # Window manager configs
├── wayland.nix # Wayland ecosystem (mako, grim, slurp)
├── x11.nix # X11 ecosystem (dunst, feh, xss-lock)
├── i3.nix # i3 window manager
├── sway.nix # Sway compositor
└── hyprland.nix # Hyprland compositor
darwin/
├── default.nix # macOS platform defaults
└── modules/
├── programs/
│ └── karabiner.nix # Karabiner-Elements key remapping
└── window-managers/
└── aerospace.nix # AeroSpace tiling window manager
systems/
├── nixos/ # Linux machine config
│ ├── default.nix # NixOS system configuration
│ └── hardware-configuration.nix
└── mac/ # macOS machine config
└── default.nix # nix-darwin system configuration
- Shared components for cross-platform consistency
- Platform-specific modules for Linux and macOS differences
- Machine-specific overrides for personal preferences
- Linux: i3 (X11), Sway (Wayland), Hyprland (Wayland)
- macOS: AeroSpace tiling window manager
- Unified tools: Rofi launcher and Polybar status bar across all WMs
- Languages: Rust, Go, Node.js, Nix
- Editors: Neovim (with LSPs), Zed Editor
- Tools: Git, Docker, CLI utilities
- DRY principle: No code duplication
- Layered imports: Platform defaults → Machine overrides
- Consistent formatting: Clean, readable configuration
sudo nixos-rebuild switch --flake ~/workspace/dotfile#nixosdarwin-rebuild switch --flake ~/workspace/dotfiles#macnix develop- Cross-platform: Add to
shared/home-manager/ - Linux-specific: Add to
linux/modules/programs/ - macOS-specific: Add to
darwin/modules/programs/
- Create new file in
linux/modules/window-managers/ - Import appropriate base module (
wayland.nixorx11.nix) - Import shared components (
../system/polybar.nix,../system/rofi.nix) - Add to system imports in
systems/nixos/default.nix
- Edit files in
systems/*/default.nix - Override platform defaults using higher priority
- Add machine-specific Home Manager module imports
- NixOS: 25.05 or later
- nix-darwin: Compatible version
- Home Manager: Latest stable
- Flakes: Enabled (
experimental-features = nix-command flakes)
The configuration uses Stylix for consistent theming across:
- Terminal applications
- Desktop environments
- Development tools
Theme is configured in shared/system/stylix.nix and enabled for both
platforms.
To update all inputs:
nix flake updateTo update specific input:
nix flake lock --update-input nixpkgs- Email configuration is machine-specific (personal vs work)
- Gaming setup is Linux-only
- Polybar works on Wayland via XWayland
- Rofi 2.0.0+ has native Wayland support
- Configuration files are symlinked from dotfiles directory
This is a personal configuration, but feel free to use it as inspiration for your own setup. The modular architecture makes it easy to adapt to different needs.