Skip to content

joinemm/empire

Repository files navigation

NixOS

My NixOs Empire

My personal NixOS flake, building dotfiles for all of my systems and servers.

The configuration is modular, with modules imported to each host as needed.

Shell scripts are built from the flake at https://github.com/joinemm/bin

Hosts

  • rome - Desktop workstation/gaming pc
  • athens - Thinkpad X1 Carbon gen11 (work laptop)
  • byzantium - Hetzner box running grafana and prometheus for monitoring
  • alexandria - Hetzner box acting as syncthing node and hosting web services
  • kyoto - Raspberry Pi 4B, mainly for blocky DNS server

Installing a configuration

Assuming NixOS is already running, a config can be switched to:

nixos-rebuild switch --flake .#$HOST

Installing to remote servers

The included script will install the system, and add ssh_host_ed25519_key specified in secrets.yaml

./scripts/install .#$HOST $REMOTE_IP --secrets hosts/$HOST/secrets.yaml

To update the remote server after changes, run nixos-rebuild with remote target:

nixos-rebuild switch --flake .#$HOST --target-host $REMOTE_IP --use-remote-sudo

Add --fast if the target system architecture does not match yours (e.g. it's aarch64 system)

SD card images

The raspberry pi config can be built as flashable sd card image for initial installation:

nix build .#nixosConfigurations.kyoto.config.system.build.sdImage

# check sd card device
lsblk
# flash to sd card
cd result/sd-image
sudo dd if=nixos-sd-image-xxx-aarch64-linux.img of=/dev/xxx bs=4M conv=fsync status=progress

This sd card can now be inserted into a raspberry pi and it will boot the configuration.

ZMK Firmware

This flake can also build the firmware for my custom Kyria split keyboard, with the keymaps located at ./keyboards/kyria/config

nix build .#firmware

The resulting .u2f firmware files for left and right half are located inside result.

The keymap svg can be drawn with nix run .#draw-keymap and will create a new file in the current directory.