Note
I'm new to Nix, so this is my personal learning repository and might not follow best practices everywhere.
My personal NixOS configuration using flakes with modular architecture and separated system/user concerns.
Reproduces my laptop setup and installs to /home/sewer/nixos as usual.
/home/sewer/nixos/
├── flake.nix # Main flake definition with system configurations
├── flake.lock # Locked dependency versions
├── hosts/ # Machine-specific configurations
└── modules/nixos/ # System-level modules
├── core/ # Essential NixOS modules (audio, networking, locale)
├── desktop/ # Desktop environment modules (e.g. window-managers, display-managers)
└── hardware/ # Hardware-specific modules (e.g. AMD/Intel/Nvidia GPU)
└── users/sewer/ # User configuration
├── nixos/ # NixOS-specific user settings
└── home-manager/ # Portable user configuration
├── packages.nix # User packages
├── shell.nix # Shell configuration
└── desktop/ # User desktop configuration
Note
Secrets live in a separate private repo, vendored as a submodule at
users/sewer/secrets. Editing one requires bumping both the submodule pointer
and flake.lock — see
users/sewer/secrets/README.md.
Test changes before applying:
sudo nixos-rebuild test --flake . # Temporary activation
sudo nixos-rebuild boot --flake . # Apply on next rebootApply (commit) update:
sudo nixos-rebuild switch --flake .Edit users/sewer/home-manager/packages.nix
- Move to
users/sewer/home-manager/programs/if the program has custom configuration - Move to
users/sewer/home-manager/desktop/if the program is part of the core desktop environment
All software versions are fixed/locked until the flake is updated,
sudo nix flake updateOr can be done as part of updating:
sudo nixos-rebuild switch --flake . --upgradesudo nixos-rebuild rollback --flake .# Delete ALL old generations and unreferenced packages
sudo nix-collect-garbage -d# Delete everything older than 7 days
sudo nix-collect-garbage --delete-older-than 7dFor hardware setup, configuration, and debugging, see HARDWARE.md. For SSH key and secrets-repo access, which must be in place before the first rebuild, see SECRETS.md.
A pre-commit hook automatically updates and stages matching flake.lock
entries when submodules move. This prevents NAR hash mismatch build
failures. To activate it in your local clone:
git config core.hooksPath hooksSee HARDWARE.md for information about using this configuration on non-NixOS systems.