Skip to content

Commit caeb1f6

Browse files
committed
Merge remote-tracking branch 'origin/main' into phorcys/motd-access-url-tmpfile
# Conflicts: # README.md # configuration.nix
2 parents d10a599 + 3a3bfeb commit caeb1f6

18 files changed

Lines changed: 402 additions & 289 deletions

File tree

.github/renovate.json5

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
// Renovate config for coder/box. Runs via the Mend-hosted Renovate GitHub App
3+
// (installed on the repo); no self-hosted workflow or token needed.
4+
//
5+
// Split by how risky an update is for a Nix flake:
6+
// * flake.lock refresh (lockFileMaintenance) — stays on the pinned nixpkgs
7+
// release branch (nixos-25.11) and just moves to its latest commit, i.e.
8+
// backported fixes/security patches. Safe, so it runs automatically.
9+
// * nixpkgs release jump (nixos-25.11 -> nixos-26.05) — edits flake.nix and
10+
// crosses a NixOS release, which is the breaking change. Gated behind the
11+
// dependency dashboard so it only opens when clicked, letting it ride with
12+
// a box major release instead of surprising operators.
13+
$schema: "https://docs.renovatebot.com/renovate-schema.json",
14+
extends: ["config:recommended"],
15+
16+
// Enable the nix manager (off by default). Lets Renovate read flake.nix inputs
17+
// and maintain flake.lock.
18+
nix: {
19+
enabled: true,
20+
},
21+
22+
// Weekly whole-lockfile refresh. This is the main win over Dependabot, which
23+
// cannot update flake.lock at all. Automerges once CI (fmt/check + lint +
24+
// tests) is green, since a within-release refresh is low risk.
25+
lockFileMaintenance: {
26+
enabled: true,
27+
schedule: ["before 6am on monday"],
28+
automerge: true,
29+
},
30+
31+
packageRules: [
32+
{
33+
// The only nix input pinned to a release branch in flake.nix. Bumping it
34+
// is a breaking release jump, so hold it behind dashboard approval; the
35+
// safe within-release patches still arrive via lockFileMaintenance above.
36+
matchManagers: ["nix"],
37+
matchDepNames: ["nixpkgs"],
38+
dependencyDashboardApproval: true,
39+
},
40+
],
41+
}

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ default `networking.hostName = "coder-box"` (set in `configuration.nix`).
3232
Two community tools do the heavy lifting:
3333

3434
- [`disko`](https://github.com/nix-community/disko) declares partition layouts in Nix. `nixos/disko-standard.nix` is a single-disk UEFI layout (1 GB EFI / ZFS root pool; no on-disk swap — zram instead). `install.sh` picks the device at install time; the ZFS `networking.hostId` is derived in Nix from the hostname (sha256 substring), so each host gets a distinct id automatically. ZFS gives cheap on-demand snapshots (take one before a risky rebuild and roll back in seconds), zstd compression, and checksum/scrub integrity.
35-
- [`nixos-facter`](https://github.com/nix-community/nixos-facter) writes a JSON hardware report (`facter.json`) that replaces `hardware-configuration.nix` on new hosts. The `nixos-facter-modules` module reads it to set kernel modules, microcode, GPU drivers, and so on.
35+
- [`nixos-facter`](https://github.com/nix-community/nixos-facter) writes a JSON hardware report (`facter.json`) that replaces `hardware-configuration.nix` on new hosts. NixOS's built-in facter module (`hardware.facter`, shipped in nixpkgs) reads it to set kernel modules, microcode, GPU drivers, and so on.
3636

3737
## Installing on a new machine
3838

@@ -61,9 +61,9 @@ sudo ./install.sh \
6161

6262
`./install.sh --help` lists everything. `--coder-admin-password-file PATH` and `--nixos-password-file PATH` read passwords from a file so they don't end up in shell history. `--no-reboot` skips the automatic reboot at the end.
6363

64-
The installer generates `hosts/<hostname>/{default.nix,local.nix,facter.json}`, copies the repo into `/etc/nixos-repo` on the target, and symlinks `/etc/nixos/flake.nix`. After reboot, `nixos-rebuild switch` Just Works. Continue with [After install](#after-install).
64+
The installer generates `hosts/<hostname>/{default.nix,local.nix,install-answers.json,facter.json}`, copies the repo into `/etc/nixos-repo` on the target, and symlinks `/etc/nixos/flake.nix`. After reboot, `nixos-rebuild switch` Just Works. Continue with [After install](#after-install).
6565

66-
> **Different partition layout?** Don't import `nixos/disko-standard.nix`; drop your own disko config into the host folder instead. See [disko examples](https://github.com/nix-community/disko/tree/master/example).
66+
> **Different partition layout?** Don't import `installer/bootstrap/disko-standard.nix`; drop your own disko config into the host folder instead. See [disko examples](https://github.com/nix-community/disko/tree/master/example).
6767
6868
> **BIOS hardware?** The shared config defaults to `systemd-boot` (UEFI). In your host's `default.nix`:
6969
> ```nix
@@ -118,7 +118,7 @@ desktop, and admin `admin@coder.com` / `PleaseChangeMe1234`. Coder comes up at
118118
`http://<hostname>.local:3000` (the `*.try.coder.app` tunnel URL is printed in
119119
any terminal on login and cached at `/tmp/coder-access-url`). Change these
120120
before sharing an image by dropping a gitignored
121-
`hosts/<host>/local.nix` (same shape as `local.nix.example`).
121+
`hosts/<host>/local.nix` (same shape as `installer/bootstrap/local.nix.example`).
122122

123123
### Appliance ISO (`_appliance-iso`)
124124

@@ -145,7 +145,7 @@ sudo dd if=out/appliance-iso/iso/coder-box-appliance-*.iso of=/dev/sdX bs=4M sta
145145
> a working build + boot.
146146
147147
Built with [disko](https://github.com/nix-community/disko)'s image builder, so
148-
it carries the real on-disk GPT layout from `nixos/disko-standard.nix` (1 GB
148+
it carries the real on-disk GPT layout from `installer/bootstrap/disko-standard.nix` (1 GB
149149
ESP + ZFS root pool) and **state survives reboots**, exactly like a machine you ran
150150
`install.sh` on. `hosts/_appliance-disk/default.nix` imports
151151
`disko-standard.nix` + `box-turnkey.nix`.
@@ -205,9 +205,10 @@ on every `sudo nixos-rebuild switch`.
205205
sudo nixos-rebuild switch # most changes
206206
sudo nixos-rebuild boot && sudo reboot # changes that touch the desktop stack
207207

208-
# Edited hosts/<host>/local.nix or facter.json? Re-mark intent-to-add:
208+
# Edited hosts/<host>/local.nix, install-answers.json, or facter.json? Re-mark intent-to-add:
209209
sudo git -C /etc/nixos-repo add --intent-to-add -f \
210210
hosts/<host>/local.nix \
211+
hosts/<host>/install-answers.json \
211212
hosts/<host>/facter.json
212213
```
213214

@@ -266,14 +267,14 @@ Fully automated, no follow-up steps needed. The service:
266267
3. Drops and recreates the PostgreSQL database
267268
4. Wipes `/var/lib/coder` (data dir, sentinel, tokens, Podman volumes)
268269
5. Starts Coder and waits for the API
269-
6. Re-bootstraps the admin user from credentials in the host's `local.nix`
270+
6. Re-bootstraps the initial user from `services.coder-nixos.initialUser` (set in the host's `install-answers.json`)
270271
7. Mints a fresh long-lived session token → writes to `/etc/coder/session-token`
271272
8. Restarts `coder-redirect`
272273
9. Runs `nixos-rebuild switch` to push templates back via `coder-template-sync`
273274

274275
### Changing the admin password
275276

276-
1. Edit `hosts/<host>/local.nix`, update `CODER_ADMIN_PASSWORD`.
277+
1. Edit `hosts/<host>/install-answers.json`, update `initialUser.password` (or override `services.coder-nixos.initialUser.password` in `local.nix`).
277278
2. Run `sudo nixos-rebuild switch` to bake the new password into the service.
278279
3. Run `sudo systemctl start coder-reset` to wipe and re-bootstrap with the new password.
279280

agents.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ sudo k3s kubectl describe pod -n coder-workspaces <pod-name>
198198
- **Template sync skips**, if `/etc/coder/session-token` is empty, the activation script exits cleanly. The token is auto-populated by `coder-init-admin.service`; if it's missing, check `journalctl -u coder-init-admin`.
199199
- **`coder` binary path** — the binary is in PATH via NixOS environment; don't hardcode nix store paths in scripts (they change with every package update).
200200
- **`--flake /etc/nixos` fails**`/etc/nixos` is a plain dir holding only a `flake.nix` *symlink* into `/etc/nixos-repo`. Nix follows the symlink into the store but can't find the sibling files (configuration.nix, hosts/, nixos/), dying with `path '/nix/store/...-source/etc/nixos-repo/flake.nix' does not exist`. Always rebuild against the real tree: `--flake /etc/nixos-repo` (or `cd /etc/nixos-repo && nixos-rebuild switch --flake .`).
201-
- **`Git tree '/etc/nixos-repo' is dirty` warning** — harmless. `hosts/<host>/{local.nix,facter.json}` are gitignored and intent-to-added by the installer, so the tree always reads "dirty". After editing them, re-mark intent-to-add so the flake sees them: `sudo git -C /etc/nixos-repo add --intent-to-add -f hosts/<host>/local.nix hosts/<host>/facter.json`.
201+
- **`Git tree '/etc/nixos-repo' is dirty` warning** — harmless. `hosts/<host>/{local.nix,install-answers.json,facter.json}` are gitignored and intent-to-added by the installer, so the tree always reads "dirty". After editing them, re-mark intent-to-add so the flake sees them: `sudo git -C /etc/nixos-repo add --intent-to-add -f hosts/<host>/local.nix hosts/<host>/install-answers.json hosts/<host>/facter.json`.
202202
- **ScreenConnect blank screen** — the box now runs GNOME on Wayland (GDM), and GNOME 49 dropped the Xorg session, so there is no X11 desktop to fall back to. ScreenConnect reaches `DISPLAY=:0` through XWayland (see `nixos/screenconnect.nix`) but **cannot screen-capture the Wayland compositor** through it, so the remote view may be black/blank. Capturing the GNOME session needs a Wayland-aware path (PipeWire/portal, e.g. `gnome-remote-desktop`); the X11 agent will connect but not mirror the desktop.
203203

204204
## Wildcard App Access (TODO)
@@ -214,11 +214,14 @@ sudo k3s kubectl describe pod -n coder-workspaces <pod-name>
214214
```
215215
/etc/nixos-repo/ # repo root (a Nix flake; sudo git required)
216216
flake.nix # entry point: nixosConfigurations.<host> per machine
217-
flake.lock # pinned nixpkgs / disko / nixos-facter-modules
217+
flake.lock # pinned nixpkgs / disko
218218
configuration.nix # shared NixOS config (edit here for services/packages)
219-
local.nix.example # template for hosts/<host>/local.nix
219+
install.sh # live-USB installer (writes hosts/<host>/{default.nix,local.nix,install-answers.json,facter.json})
220+
installer/
221+
bootstrap/ # assets install.sh consumes when generating a new host
222+
disko-standard.nix # shared disko config: UEFI + single-disk layout for new hosts
223+
local.nix.example # template copied to hosts/<host>/local.nix; reads install-answers.json and applies the values
220224
nixos/
221-
disko-standard.nix # shared disko config: UEFI + single-disk layout for new hosts
222225
modules/ # NixOS service modules (services.coder-nixos.*)
223226
k3s/ # base single-node k3s server
224227
podman/ # k3s + rootless Podman socket runtime

coderd/templates/k3s-dev/.terraform.lock.hcl

Lines changed: 52 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)