A modular NixOS flake configuration with Sway window manager, Home Manager integration, hybrid graphics support, and theme switching capabilities.
Warning
Unverified on a clean install. This config runs on my own machine, but I have not tested it end to end from a fresh NixOS install. Applying it as-is on your hardware may fail or leave your system in a broken state. Read every file before running anything, especially nixos/hardware.nix (NVIDIA bus IDs) and nixos/users.nix (accounts, sudo). Use at your own risk.
.
├── flake.nix # Root flake definition
├── nixos/ # NixOS system configuration
│ ├── configuration.nix # Main system configuration
│ ├── hardware.nix # Hardware configuration (NVIDIA hybrid graphics)
│ ├── system.nix # System settings (timezone, locale)
│ ├── users.nix # User configuration
│ ├── services.nix # System services
│ ├── graphics.nix # Graphics settings
│ └── packages.nix # System packages
└── home/ # Home Manager configuration
├── home.nix # Main home configuration
├── programs.nix # Program configurations
├── packages.nix # User packages
├── theme.nix # Theme switching setup
├── theme-switch.sh # Theme switching script
├── sway/ # Sway window manager
│ ├── sway.nix # Sway module
│ └── config # Sway configuration file
└── waybar/ # Waybar status bar
├── waybar.nix # Waybar module
├── config # Waybar JSON configuration
├── style.css # Dark theme CSS
└── style-light.css # Light theme CSS
- Sway Window Manager: Tiling window manager for Wayland
- Hybrid Graphics: NVIDIA Prime offloading support (Intel UHD 630 / NVIDIA GTX 1660 Ti)
- Theme Switching: Toggle between dark and light themes (Mod+Shift+t)
- Development Tools: VS Code, Chrome, Python, Node.js, Rust, Go
- Minimalist Aesthetics: Clean, dark theme by default
Installing on a fresh machine? See INSTALL.md for a full walkthrough (disk partitioning, bus ID detection, first boot).
# Build NixOS configuration
sudo nixos-rebuild switch --flake .#nixos-laptop
# Build Home Manager configuration
home-manager switch --flake .#userPress Mod+Shift+t to toggle between dark and light themes. The theme preference is saved and restored on startup.
You may need to adjust the NVIDIA bus IDs in nixos/hardware.nix. Find your bus IDs with:
lspci | grep VGAUpdate the nvidiaBusId and intelBusId accordingly.
Edit nixos/users.nix to change the default username and groups.
Security Note: The default configuration sets security.sudo.wheelNeedsPassword = false, which allows passwordless sudo for the wheel group. For multi-user systems or enhanced security, consider setting this to true or using security.sudo.extraRules for more granular control.
- System packages:
nixos/packages.nix - User packages:
home/packages.nix
- NixOS with flakes enabled
- Home Manager
- NVIDIA graphics card with Prime offloading support