Nixos flake configuration for server running on dellprecisionM4800
Find a file
2026-07-28 08:10:22 -06:00
modules Potential wger networking fix 2026-07-28 08:10:22 -06:00
secrets Potential wger networking fix 2026-07-28 08:10:22 -06:00
.gitignore Initial commit 2026-06-15 10:09:41 -06:00
configuration.nix Add wger (fitness tracker) module. Comment overhaul and bug fixes 2026-07-28 07:29:17 -06:00
flake.lock Initial commit 2026-06-15 10:09:41 -06:00
flake.nix Initial commit 2026-06-15 10:09:41 -06:00
hardware-configuration.nix Initial commit 2026-06-15 10:09:41 -06:00
README.md Updated README.md for dellprecisionM4800 2026-06-22 16:26:14 -06:00

nixos-dellprecisionM4800

NixOS flake configuration for a home server running Docker containers, Caddy reverse proxy, and Cloudflare DDNS.

Structure

nixos/
├── flake.nix                  # Entry point — pins nixpkgs
├── flake.lock                 # Lockfile (commit this!)
├── configuration.nix          # Top-level system config
├── modules/
│   ├── docker.nix             # Docker daemon + container definitions
│   ├── caddy.nix              # Reverse proxy virtual hosts
│   └── cloudflare-ddns.nix    # DDNS updater systemd service/timer
├── README.md                  # README.md for entire repo
├── secrets/
|   |── README.md              # How to provision secrets (files git-ignored)
│   └── files/
|       └── cf_api_token       # Cloudflare API token (plain text)
└── .gitignore

First-time deployment

1. Prepare the PC

Boot into your existing NixOS image and SSH in. Then:

2. Copy this repo to the PC

# From your dev machine
scp -r nixos_dell/ admin@192.168.1.11:/home/admin
# Then copy the files into /etc/nixos/ from within the server
sudo rsync -av nixos_dell/ /etc/nixos/ # Copies folder contents, preserving internal structure w/o copying parent folder

# Or clone from git once you've pushed it:
# git clone https://github.com/you/nixos /etc/nixos

3. Apply the configuration

cd /etc/nixos
sudo nixos-rebuild switch --flake /etc/nixos#nixos-dellprecisionM4800

Updating

# Pull latest changes
cd /etc/nixos && git pull

# Update nixpkgs pin
nix flake update

# Apply
sudo nixos-rebuild switch --flake /etc/nixos#nixos-dellprecisionM4800

Adding a new container + subdomain

  1. Add a block to containers in modules/docker.nix
  2. Add a matching virtualHosts entry in modules/caddy.nix
  3. Rebuild the configuration

Useful commands

# Check systemd service status
systemctl status docker-uptime-kuma
systemctl status caddy
systemctl status cloudflare-ddns.timer

# View DDNS logs
journalctl -u cloudflare-ddns -f

# Force a DDNS update now
systemctl start cloudflare-ddns

# Garbage-collect old Nix generations
sudo nix-collect-garbage -d