switched to flakes and built out modularity

This commit is contained in:
2026-02-11 13:45:21 -05:00
parent 5f6a53c15f
commit c5a99c5b75
15 changed files with 489 additions and 151 deletions

View File

@@ -1,5 +1,73 @@
![](./assets/nixhomelab-logo.png)
This is the config of a nix based homelab server. Currently a work in progress.
## Clustering with K3s
K3s is a simplified version of Kubernetes.
NixOS homelab configuration managed with flakes.
## Layout
- `flake.nix`: entrypoint and pinned `nixpkgs` input
- `hosts/<name>/default.nix`: per-host settings and service toggles
- `hosts/<name>/hardware-configuration.example.nix`: template showing expected file location
- `profiles/*.nix`: shared host profiles (server base, workstation base, etc.)
- `modules/control.nix`: central `control` option definitions
- `modules/services/*.nix`: per-service implementation modules
## Central Service Control
Services are toggled in one place inside each host config:
```nix
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:
```bash
sudo nixos-generate-config --show-hardware-config > hosts/nixos/hardware-configuration.nix
```
## Usage
Build a host config:
```bash
nix build .#nixosConfigurations.nixos.config.system.build.toplevel
```
Test on a target machine:
```bash
sudo nixos-rebuild test --flake .#nixos
```
Apply on a target machine:
```bash
sudo nixos-rebuild switch --flake .#nixos
```
## Included Native Modules
- Home Assistant
- Jellyfin
- Gitea
- Navidrome
- Vaultwarden
- Nextcloud
- k3s
Nextcloud requires `control.nextcloud.adminPassFile` when enabled.