This repository contains my modular NixOS system configuration, powered by Nix Flakes and Home Manager.
- 🔁 Flake-based for reproducibility
- 🧩 Modular configuration per host
- 💻 Includes Home Manager for user-level setup
- 📁 Centralized
variables.nix
for system flags and module toggles
git clone https://github.com/Sandbox-Freddy/.dotfiles ~/.dotfiles
cd ~/.dotfiles
Edit:
./hosts/{work,private}/variables.nix
Then run:
sudo nixos-rebuild switch --flake ~/.dotfiles#work
For later rebuilds:
rebuild
or
switch
rebuild
andswitch
is an alias fornixos-rebuild
with predefined arguments.
-
Create a new folder in
./hosts/
, e.g.my-laptop
-
Add these files:
configuration.nix
default.nix
hardware-configuration.nix
variables.nix
-
Your
variables.nix
should follow this structure:
{
username = "freddy";
host = "default";
system = "x86_64-linux";
stateVersion = "25.05";
modules = {
console = {
fish = true;
};
driver = {
nvidia = false;
amdgpu = false;
};
gui = {
gnome = true;
};
software = {
display-link = false;
docker = true;
flatpak = false;
git = true;
noisetorch = true;
wine = false;
vscode = true;
};
systemSettings = {
bootanimation = true;
gaming = false;
printer = true;
virtualization = false;
};
};
git = {
lfs = true;
extraConfig = {
defaultBranch = "main";
credential-helper = "store";
};
credentials = {
email = "31123359+Sandbox-Freddy@users.noreply.github.com";
name = "Sandbox-Freddy";
};
includes = [];
};
gnome = {
fav-icon = [
];
};
}
- Finally, register the host in your
flake.nix
:
nixosConfigurations = {
my-laptop = mkNixosConfiguration {
modules = [ ./hosts/my-laptop ];
hostVariables = import ./hosts/my-laptop/variables.nix;
};
};
Ensure that your variables.nix
file contains all required attributes. Use a central default like:
let default = import ../../variables/defaultVariables.nix; in
default // { ... }
This ensures every module gets all expected keys.
Make sure you’re not accidentally shadowing or omitting expected fields:
- Use
default.modules // { ... }
instead of{}
when overriding - Use
lib.attrByPath
orlib.getAttrFromPath
for optional flags
Run:
nix flake update
rebuild switch --flake .#your-host
If you're using nix-direnv
, reload the shell with direnv reload
.
This project is licensed under the MIT License.
💬 Feedback, PRs, and questions are always welcome.