NixOS homelab configuration managed with flakes.
Layout
flake.nix: entrypoint and pinnednixpkgsinputhosts/<name>/default.nix: per-host settings and service toggleshosts/<name>/hardware-configuration.example.nix: template showing expected file locationprofiles/*.nix: shared host profiles (server base, workstation base, etc.)modules/control.nix: centralcontroloption definitionsmodules/services/*.nix: per-service implementation modules
Central Service Control
Services are toggled in one place inside each host config:
control = {
jellyfin.enable = true;
gitea.enable = true;
navidrome = {
enable = true;
musicFolder = "/mnt/seagate8tb/navidrome/music";
dataFolder = "/mnt/seagate8tb/navidrome/data";
};
};
Each service has its own module in modules/services/.
Hardware Config Pattern
hosts/<name>/default.nix automatically imports ./hardware-configuration.nix only if that file exists.
On each NixOS host, generate and store host hardware data in the host folder:
sudo nixos-generate-config --show-hardware-config > hosts/nixos/hardware-configuration.nix
Usage
Build a host config:
nix build .#nixosConfigurations.nixos.config.system.build.toplevel
Test on a target machine:
sudo nixos-rebuild test --flake .#nixos
Apply on a target machine:
sudo nixos-rebuild switch --flake .#nixos
Included Native Modules
- Home Assistant
- Jellyfin
- Gitea
- Navidrome
- Vaultwarden
- Nextcloud
- k3s
Nextcloud requires control.nextcloud.adminPassFile when enabled.
Description
Homelab built in nix. Join the discussion https://matrix.to/#/#nix-homelab:matrix.briannelson.dev
https://matrix.to/#/#nix-homelab:matrix.briannelson.dev
Readme
527 KiB
Languages
Nix
100%
