My NixOS configuration including hardware, configuration, flake, home manager.
- Nix 100%
| home | ||
| hosts/laptop_01 | ||
| modules | ||
| users | ||
| configuration.nix | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
NixOS Configuration
My personal NixOS flake supporting multi-host, multi-user, multi-DE. Each host loading the modules it needs.
It is licenced under MIT so feel free to modify, use and share.
[NOTE] If you plan on using it, be careful of removing my ssh keys, autoupdates from this repository...
Design
The flake uses mkHost helper that reads hosts/<host>/users.nix to setup the user config and DE if needed. it import only the strict necessary modules / configs.
Each user's config is split into three layers:
| Layer | Path | What goes here |
|---|---|---|
| shell | users/<user>/home.nix |
Shell, git, anything usable headless |
| DE common | home/common.nix + modules/desktop/common.nix |
Common apps for all desktop users |
| DE custom | users/<user>/desktop/<de>.nix |
User's own DE settings and theming |
Repository Structure
NixOS/
├── flake.nix # mkHost helper + nixosConfigurations outputs
├── configuration.nix # shared system config
│
├── hosts/
│ └── laptop_01/
│ ├── default.nix # host-specific hardware + services
│ ├── hardware-configuration.nix
│ ├── users.nix # where to add the users of a host
│ └── modules/
│ └── gpu-env.nix # NVIDIA Prime env vars + CUDA btop
│
├── modules/
│ ├── users.nix # defines users option
│ └── desktop/
│ ├── sddm.nix # display manager, loaded if desktop is present
│ ├── common.nix # common config for all DE users
│ ├── hyprland-noctalia/
│ │ ├── system.nix # hyprland programs
│ │ └── home.nix # UWSM env, Hyprland config, Noctalia
│ ├── kde/
│ │ ├── system.nix # kde programs
│ │ └── home.nix
│ └── programs/
│ ├── firefox-system.nix # programs specific configs
│ └── firefox-home.nix
│
├── home/
│ └── common.nix # headless only fish, starship, btop
│
└── users/
├── charon/
│ ├── system.nix # NixOS user declaration
│ ├── home.nix # minimal home (username, stateVersion)
│ └── desktop/
│ ├── default.nix # DE layer: personal packages
│ ├── firefox.nix
│ └── hyprland-noctalia.nix # DE specific configuration
└── peppa/
├── system.nix # minimal configuration for a user
└── home.nix
Adding a host :
- Create hosts// with default.nix, hardware-configuration.nix and users.nix
- Add nixosConfigurations. = mkHost ""; to flake.nix
Adding a user :
- Create users//system.nix and users//home.nix
- Add the user to hosts//users.nix with their desktop (or null for headless)
- Optionally add users//desktop/default.nix for GUI-only config and users//desktop/.nix for DE-specific config