Skip to content

Server Overview

The server configuration (homelab) is a headless Intel-based system running containerised services. It uses an ephemeral root filesystem (impermanence pattern), aggressive security hardening, and automated maintenance.

Hardware

ComponentDetail
CPUIntel (with kvm-intel module)
GPUIntel integrated (hardware transcoding via intel-media-driver)
Primary diskWD Black SN850X 2000GB NVMe
Backup disk512GB SATA SSD
NetworkRealtek r8169 Gigabit Ethernet
FirmwareIntel microcode updates enabled

System Identity

nix
specialArgs = {
  username = "nixos";
  hostname = "homelab";
  domain = "nemnix.site";
};

Design Philosophy

The server follows a minimal, hardened, reproducible approach:

  • No desktop environment -- headless operation only.
  • No documentation -- man pages, info, and NixOS docs are all disabled.
  • No default packages -- environment.defaultPackages = lib.mkForce [].
  • No nano -- programs.nano.enable = false.
  • No fonts, icons, sounds -- all XDG features disabled.
  • No stub ld -- environment.stub-ld.enable = false.

Only five packages are installed:

nix
environment.systemPackages = [ btop yazi helix lynis agenix ];
PackagePurpose
btopSystem monitoring
yaziFile manager
helixText editor ($EDITOR and $VISUAL)
lynisSecurity auditing tool
agenixSecrets management CLI

Module Map

ModulePurpose
bootloader.nixsystemd-boot
kernel.nixHardened kernel + extensive sysctl
disko.nixBTRFS + LUKS + backup disk + remote unlock + rollback
impermanence.nixPersistent paths declaration
network.nixStatic IP + NAT + firewall
openssh.nixHardened SSH daemon
nix.nixNix daemon settings
users.nixUser account
bash.nixShell aliases
git.nixGit identity
packages.nixMinimal packages + disabled features
graphics.nixIntel media driver
fstrim.nixSSD TRIM + I/O scheduler udev rules
systemd.nixsystemd hardening + disabled services
restic.nixEncrypted daily backups
podman.nixContainer runtime
auto-upgrade.nixWeekly unattended upgrades
hardware-configuration.nixGenerated hardware config

Shell Aliases

Defined in bash.nix for quick server administration:

bash
# Container access
immich       # sudo nixos-container root-login immich
adguard      # sudo nixos-container root-login adguard
traefik      # sudo nixos-container root-login traefik
authelia      # sudo nixos-container root-login authelia
vaultwarden  # sudo nixos-container root-login vaultwarden
opencloud    # sudo nixos-container root-login opencloud

# System management
update       # nix flake update --flake ~/nixos-homelab
rebuild      # sudo nixos-rebuild switch --flake ~/nixos-homelab
garbage      # Full garbage collection + store verification + optimisation

I/O Scheduler Tuning

Custom udev rules in fstrim.nix set optimal I/O schedulers per device type:

Device TypeSchedulerRationale
HDD (rotational=1)bfqFair queuing for rotational media
SATA SSD (rotational=0)mq-deadlineLow latency for SATA SSDs
NVMe (nvme*)noneNVMe has internal scheduling; kernel scheduler adds overhead

systemd Configuration

The server has aggressive systemd hardening in systemd.nix:

  • Emergency mode disabled -- the server must never drop to an interactive prompt.
  • Emergency targets suppressed in initrd.
  • Unused services disabled: pre-sleep, prepare-kexec, systemd-rfkill, systemd-hibernate-clear, systemd-networkd-wait-online.
  • Journal hardened: private network, protected hostname and kernel modules, restrictive umask.
  • Fast shutdown timeouts: runtime 15s, reboot 30s, kexec 1m.

Built with VitePress