So anyways. Here's my dots. I hope you like them.
Welcome! This repository contains my personal NixOS configuration, built using flakes and inspired by EmergentMind's nix-config. It is a highly modular, reproducible, and scalable way to manage multiple NixOS systems and user environments, with a single, text-based configuration.
- Reproducibility: Every system and user environment is described as code, so you can rebuild or roll back at any time.
- Modularity: Hosts and home environments are separated, but mirror each other for clarity and maintainability.
- Scalability: Easily add new machines, users, or features without spaghetti.
This structure makes it easy to understand what's happening where, and how to extend it for your own needs. I can rebuild my whole digital life in minutes, anywhere, with a single command. I'm dedicated to maintainable, scalable, and modular practices. People be like "Uhmm aight, but... Why?!". Idk I guess I like rabbit holes. Deep, dark, and painful. But declarative. Now I don't fear nuking my system and starting over.
.
├── flake.nix # Entry point: ties everything together
├── hosts/ # System configs (per-machine)
│ ├── common/ # Shared system modules
│ │ ├── core/ # System-level settings for all hosts (locale, DNS, shell, sops secrets, etc.)
│ │ ├── optional/ # Optional system modules (WM, apps, services, etc.) <-- the juice
│ │ └── users/ # Global user settings (groups, home-manager refs)
│ └── $hostname/ # Host-specific system configs <-- imports the above
│
├── home/ # Home-manager configs (per-user)
│ ├── common/ # Shared user modules across all users
│ │ ├── core/ # User-level settings always present for ALL users
│ │ └── optional/ # Optional user modules
│ └── $username/ # User-specific home configs for each system (apps, etc.)
│ ├── common/ # Shared user modules
│ │ ├── core/ # User-level settings always present for THIS user (env, git, etc.)
│ │ └── optional/ # Optional user modules (browsers, vscode, etc.)
│ └── $hostname # Host-specific home configs <-- imports the above
│
├── modules/ # (Future) Custom modules for NixOS/home-manager
├── overlays/ # (Future) Custom package overlays
├── pkgs/ # (Future) Custom packages
├── still_to_flake/ # Legacy or WIP configs not yet flake-ified
└── ...
flake.niximports and connects everything. It defines the inputs (Nixpkgs, home-manager, etc.) and outputs (system and home-manager configs for each host/user).hosts/contains all system-level configs. Each host (machine) has its own directory, plus acommon/folder for shared modules (like localization, SSH, or secrets management).home/contains user-level (dotfiles) configs, managed by home-manager. Each user has a folder, and inside, a config for each host they log into. There's also acommon/folder for settings shared across all hosts for a user.modules/,overlays/,pkgs/are placeholders for custom modules, overlays, and packages. They're ready for future expansion, so you can easily add your own tweaks without breaking the core structure.still_to_flake/contains legacy or experimental configs that haven't been fully migrated to the flake structure yet.
- Mirror Structure: Both
hosts/andhome/use a similar layout, making it intuitive to see which configs apply system-wide vs. per-user. - Separation of Concerns: System configs (NixOS modules) and user configs (home-manager) are kept distinct, but are easy to cross-reference.
- Easy to Extend: Want to add a new machine? Just add a
hosts/$hostname/folder with the usual imports and hardware, create its users by adding ahome/$username/$hostname.nixfile, and finally import both inflake.nix. New user? Just add ahome/$username/folder. - Future-Proof: The modular design means you can grow this setup with overlays, custom modules, or new Nix features as they become relevant.
If you bumped your head and forgot how to use this, here's a quick refresher:
- Clone this repo:
git clone https://github.com/TheFacc/nix-config.git cd nix-config - Review the structure:
- Edit or add your host in
hosts/ - Edit or add your user in
home/
- Edit or add your host in
- Build or switch:
# For system (as root) nixos-rebuild switch --flake .#your-hostname # For user environment (as user) home-manager switch --flake .#your-username@your-hostname
- Tweak, expand, and enjoy!
Sensitive values (e.g. Syncthing GUI password, credentials, etc.) are not stored in the Nix store as plaintext. This flake uses sops-nix with SOPS and age:
- In git: encrypted
hosts/common/core/secrets/secrets.yaml(ciphertext),.sops.yaml(age public recipients only), andsecrets.yaml.example(placeholders). - On each machine: private age key at
/var/lib/sops-nix/keys.txt(created manually or by tooling - see the doc below). - At runtime: decrypted material under
/run/secrets(and rendered templates), not world-readable store paths.
If you clone this repo: you cannot rebuild the same secrets without your own age keys and a new encrypted secrets.yaml. Short flow:
- Install
ageandsops(nix shell nixpkgs#age nixpkgs#sops). - Generate keys and fill
hosts/common/core/secrets/.sops.yamlwith your public age keys. - Copy
secrets.yaml.example→secrets.yaml, edit values, then encrypt withsops(nested YAML shape must match the example - see the doc). - Put the matching private key on each host as
/var/lib/sops-nix/keys.txt, thensudo nixos-rebuild switch --flake .#hostname.
Full step-by-step notes, troubleshooting, and what is safe to publish are in hosts/common/core/secrets/README.md.
Feel free to fork, adapt, or reach out if you have questions or want to collaborate!