133 lines
4.8 KiB
Markdown
133 lines
4.8 KiB
Markdown
# NixOS Config Flake
|
|
|
|
A Nix flake managing NixOS, nix-darwin, and Home Manager configurations across multiple hosts.
|
|
|
|
## Hosts
|
|
|
|
| Host | Type | Role | Disk Config |
|
|
|------------|-----------------|---------------------------------|-------------|
|
|
| `acheron` | Linux Server | Server | disko |
|
|
| `armaros` | Linux Server | Server | disko |
|
|
| `buildbox` | Linux Server | CI / Build server | disko |
|
|
| `ender-ml` | Linux Server | ML / ComfyUI server | disko |
|
|
| `eva-01` | Linux Desktop | ThinkPad X1 Nano Gen 1 | disko |
|
|
| `eva-02` | macOS | Darwin / Mac | — |
|
|
| `eva-03` | Linux Desktop | Desktop with ComfyUI | disko |
|
|
|
|
Each host gets an auto-generated `<hostname>-iso` rescue/installer ISO (except `eva-02`).
|
|
|
|
## Structure
|
|
|
|
```
|
|
├── flake.nix # Main flake with all host definitions
|
|
├── flake.lock
|
|
├── hosts/
|
|
│ ├── acheron/ # Server #1
|
|
│ │ ├── configuration.nix
|
|
│ │ ├── disko-config.nix
|
|
│ │ ├── hardware-configuration.nix
|
|
│ │ └── iso.nix
|
|
│ ├── armaros/ # Server #2
|
|
│ │ └── ...
|
|
│ ├── buildbox/ # CI / Build
|
|
│ │ └── ...
|
|
│ ├── ender-ml/ # ML server with ComfyUI
|
|
│ │ └── ...
|
|
│ ├── eva-01/ # ThinkPad X1 Nano (Linux desktop)
|
|
│ │ └── ...
|
|
│ ├── eva-02/ # macOS
|
|
│ │ └── configuration.nix
|
|
│ ├── eva-03/ # Linux desktop with ComfyUI
|
|
│ │ └── ...
|
|
│ └── iso/
|
|
│ └── default.nix # Shared rescue ISO module
|
|
├── home-manager/
|
|
│ ├── home.nix # Home Manager config for `rogueking`
|
|
│ ├── cris-home.nix # Home Manager config for `cris`
|
|
│ ├── commands/ # CLI tool modules
|
|
│ │ ├── commands.nix
|
|
│ │ ├── direnv.nix
|
|
│ │ ├── eza.nix
|
|
│ │ ├── git.nix
|
|
│ │ ├── newsboat.nix
|
|
│ │ ├── starship.nix
|
|
│ │ ├── tmux.nix
|
|
│ │ └── zsh.nix
|
|
│ │ └── custom/ # Custom command packages
|
|
│ │ └── fastfetch/
|
|
│ │ └── nixvim/
|
|
│ └── programs/ # GUI / desktop program modules
|
|
│ ├── programs.nix
|
|
│ ├── ghostty/
|
|
│ ├── hypr/
|
|
│ └── rofi/
|
|
└── assets/
|
|
└── pfp/ # Profile pictures
|
|
```
|
|
|
|
## Rescue / Installer ISOs
|
|
|
|
Every Linux host (except macOS) has an auto-generated ISO configuration (`<hostname>-iso`) that provides:
|
|
|
|
- SSH access with the configured public key
|
|
- The host's `disko-config.nix` copied to `/etc/disko-config.nix`
|
|
- Common rescue tools (`git`, `neovim`, `wget`, `curl`, `parted`, `gptfdisk`, `efibootmgr`)
|
|
|
|
### Building an ISO
|
|
|
|
```bash
|
|
nix build .#nixosConfigurations.acheron-iso.config.system.build.isoImage
|
|
```
|
|
|
|
### Using a rescue ISO
|
|
|
|
```bash
|
|
# Partition and format disks
|
|
disko --mode disko /etc/disko-config.nix
|
|
|
|
# Install the system
|
|
nixos-install --flake /etc/nixos#hostname
|
|
```
|
|
|
|
## Flake Inputs
|
|
|
|
| Input | Source |
|
|
|--------------------------|----------------------------------------------|
|
|
| `nixpkgs` | `nixos-26.05` |
|
|
| `nixpkgs-unstable` | `nixos-unstable` |
|
|
| `nix-darwin` | `nix-darwin-26.05` |
|
|
| `home-manager` | `release-26.05` (follows `nixpkgs`) |
|
|
| `home-manager-unstable` | `master` (follows `nixpkgs-unstable`) |
|
|
| `nixvim` | `nixos-26.05` |
|
|
| `nixos-hardware` | `master` |
|
|
| `disko` | Latest |
|
|
| `nix-snapd` | Latest |
|
|
| `comfyui-nix` | `main` |
|
|
|
|
## Dev Shell
|
|
|
|
A `direnv`-friendly dev shell is available with `nixd`, `alejandra`, `nil`, `git`, and `bun`.
|
|
|
|
```bash
|
|
# Enter the dev shell
|
|
nix develop
|
|
|
|
# Or with direnv (if you have the .envrc set up)
|
|
direnv allow
|
|
```
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Rebuild a host
|
|
sudo nixos-rebuild switch --flake .#eva-01
|
|
|
|
# Darwin rebuild
|
|
darwin-rebuild switch --flake .#eva-02
|
|
|
|
# Update flake inputs
|
|
nix flake update
|
|
|
|
# Build a specific host's ISO
|
|
nix build .#nixosConfigurations.eva-01-iso.config.system.build.isoImage
|
|
``` |