Files
nix-config-ryan4yin/hosts
Ryan Yin 29760ddb27 refactor: update niri, write config in kdl, remove niri-flake (#237)
• Updated input 'nixpkgs':
  → 'github:NixOS/nixpkgs/0254eab410b90ef2420c1059f908ae777e3b02f9?narHash=sha256-/US2Ei9JHXHVBAxV4FX49Q7H5s4UNBrIiOA6Xjzgq44%3D' (2025-12-06)

• Updated input 'home-manager':
    'github:nix-community/home-manager/f4cb25928fafa9ae68660fe71f730fc820a59028?narHash=sha256-5xOuutXM7UPTUcn3uDAD8UlPQsXmqPrX81cXoDOAGcA%3D' (2025-11-26)
  → 'github:nix-community/home-manager/89c9508bbe9b40d36b3dc206c2483ef176f15173?narHash=sha256-rB45jv4uwC90vM9UZ70plfvY/2Kdygs%2BzlQ07dGQFk4%3D' (2025-12-17)

• Updated input 'nixpkgs-master':
    'github:nixos/nixpkgs/6812bcfd614abedbdb3f68d7b6554eda6ca3e014?narHash=sha256-sNF/PZcuzYBHKRBkerEiPf5mkZM15A3fWD%2BlqpwKc60%3D' (2025-12-15)
  → 'github:nixos/nixpkgs/e50ab9bb181f9fb3ce00e7a6007c70ddaa007203?narHash=sha256-acPMRCAPgPykzkwATwD1EfF7xgmbraAvIJyCeR6bKxc%3D' (2025-12-18)

Signed-off-by: Ryan Yin <xiaoyin_c@qq.com>
2025-12-18 19:56:46 -06:00
..
2025-09-24 11:47:23 +08:00
2025-08-21 15:40:28 +08:00

Hosts

This directory contains all host-specific configurations for my NixOS and macOS systems.

Current Host Inventory

Physical Machines

idols - Main Workstations

Named after characters from "Oshi no Ko":

Host Platform Hardware Purpose Status
ai NixOS i5-13600KF + RTX 4090 Gaming & Daily Use Active
aquamarine KubeVirt VM Virtual Monitoring & Services Active
kana NixOS Virtual Reserved Not Used
ruby NixOS Virtual Reserved Not Used

darwin - macOS Systems

Named after characters from "Frieren: Beyond Journey's End":

Host Platform Hardware Purpose Status
fern macOS MacBook Pro M2 13" 16GB Personal Use Active
frieren macOS MacBook Pro M4Pro 14" 48GB Work Use Active

12kingdoms - Homelab Servers & Apple Silicon Linux

Named after "Twelve Kingdoms":

Host Platform Hardware Purpose Status
shoukei NixOS MacBook Pro M2 NixOS on Apple Silicon Active
shoryu NixOS MoreFine S500Plus (AMD Ryzen 9 5900HX) KubeVirt Host & K3s Master Active
shushou NixOS MinisForum UM560 (AMD Ryzen 5 5625U) KubeVirt Host & K3s Master Active
youko NixOS MinisForum HX99G (AMD Ryzen 9 6900HX) KubeVirt Host & K3s Master Active

Virtual Machines & Clusters

k8s - Kubernetes Infrastructure

  • KubeVirt Cluster: 3 physical mini PCs (shoryu, shushou, youko) running all VMs
  • K3s Production: 3 masters + 3 workers for production workloads
  • K3s Testing: 3 masters for testing and development

External Systems

All my riscv64 hosts:

Naming Conventions

  • idols: Characters from "Oshi no Ko" anime/manga
  • 12kingdoms: Characters from "Twelve Kingdoms" anime/novel series
  • darwin: Characters from "Frieren: Beyond Journey's End" anime/manga
  • k8s: Kubernetes-related systems follow standard naming patterns

How to Add a New Host

The easiest way to add a new host is to copy and adapt an existing similar configuration. All host configurations follow similar patterns but are customized for specific hardware and use cases.

General Process

  1. Identify a similar existing host from the directory structure above
  2. Copy the entire directory and rename it for your new host
  3. Adapt the configuration files for your specific hardware and requirements
  4. Update references in the flake outputs and networking configuration

Essential Steps

  1. Under hosts/
    1. Create a new folder under hosts/ with the name of the new host.
    2. Create & add the new host's hardware-configuration.nix to the new folder, and add the new host's configuration.nix to hosts/<name>/default.nix.
    3. If the new host need to use home-manager, add its custom config into hosts/<name>/home.nix.
  2. Under outputs/
    1. Add a new nix file named outputs/<system-architecture>/src/<name>.nix.
    2. Copy the content from one of the existing similar host, and modify it to fit the new host.
      1. Usually, you only need to modify the name and tags fields.
    3. [Optional] Add a new unit test file under outputs/<system-architecture>/tests/<name>.nix to test the new host's nix file.
    4. [Optional] Add a new integration test file under outputs/<system-architecture>/integration-tests/<name>.nix to test whether the new host's nix config can be built and deployed correctly.
  3. Under vars/networking.nix
    1. Add the new host's static IP address.
    2. Skip this step if the new host is not in the local network or is a mobile device.

File Templates

Use existing hosts as templates. The key files typically include:

  • default.nix - Main host configuration
  • hardware-configuration.nix - Auto-generated hardware settings
  • Platform-specific files (e.g., nvidia.nix, apple-silicon.nix, etc.)

Examples to Reference

  • Desktop systems: See idols-ai/ for gaming/workstation setup
  • Server systems: See kubevirt-shoryu/ for K8s/KubeVirt hosts
  • macOS systems: See darwin-fern/ for macOS configurations
  • Apple Silicon: See 12kingdoms-shoukei/ for ARM Linux setup

Distributed Building

I usually run the build command on Ai and nix will distribute the build to other NixOS machines, which is convenient and fast.

When building some packages for riscv64 or aarch64, I often have no cache available because of various changes under the hood, so I need to build much more packages than usual, which is one of the reasons why the cluster was originally built, and another reason is distributed building is cool!

References

Oshi no Ko 【推しの子】 - Wikipedia:

The Rolling Girls【ローリング☆ガールズ】 - Wikipedia:

List of Twelve Kingdoms characters

List of Frieren characters