A highly modular NixOS configuration, managed with Nix Flakes and Home Manager.
nix-config/
├── flake.nix # Flake entrypoint — inputs, outputs, and host definitions
├── flake.lock # Pinned dependency versions
├── hosts/ # Per-host NixOS configurations
├── nixos/
│ └── modules/ # Reusable NixOS modules
└── home/ # Home Manager configuration (user environment, dotfiles, etc.)
Hosts are defined in the hosts/ directory. Each host has its own configuration that imports shared NixOS modules and hardware-specific settings.
User-level configuration lives in home/, including shell setup, editor config, and any other dotfiles managed declaratively through Home Manager.
Reusable, composable NixOS modules are stored under nixos/modules/. These can be shared across multiple hosts to keep configuration DRY.
- NixOS with flakes enabled, or any Linux distro with Nix installed
- Flakes and the new nix CLI enabled in your Nix config:
# /etc/nix/nix.conf (or nix.settings in your NixOS config)
experimental-features = nix-command flakessudo nixos-rebuild switch --flake .#<hostname>home-manager switch --flake .#<username>@<hostname>nix flake update- Boot a NixOS installer and partition/format your disks.
- Mount the target filesystem at
/mnt. - Generate hardware config:
nixos-generate-config --root /mnt
- Clone this repo:
nix-shell -p git git clone https://github.com/samuelskovbakke/nix-config /mnt/etc/nixos
- Copy or symlink the generated hardware config into the appropriate host directory.
- Install:
nixos-install --flake /mnt/etc/nixos#<hostname>
- Reboot, then apply Home Manager:
home-manager switch --flake ~/.config/nixos#<username>@<hostname>
| Tool | Purpose |
|---|---|
| NixOS | Declarative OS configuration |
| Nix Flakes | Reproducible, pinned dependency management |
| Home Manager | User environment and dotfiles |
This project is licensed under the GNU General Public License v3.0. You are free to use, modify, and distribute this configuration, but any derivative work must also be distributed under the same GPL v3.0 license.