Skip to content

Commit 732deba

Browse files
docs: make ix.nix the starter surface
Closes #1503
1 parent b309ad3 commit 732deba

10 files changed

Lines changed: 59 additions & 31 deletions

File tree

docs/ix-fleet/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ each node key matches its `name`; and that every `dependsOn` names a real node.
7575
the simple attr lets the native multi-VM `ix up .#a .#b --build-vm <builder>`
7676
derive each VM name. The `<node>-system` package stays as a build alias. Merge
7777
the fleet's `nixosConfigurations` into your flake's top-level
78-
`nixosConfigurations` (see `templates/dev/flake.nix`).
78+
`nixosConfigurations` (see `templates/ix/flake.nix`).
7979
- **`ReplacementImage`** (`:34`): `imageName`, `imageTag`, `destination`,
8080
`source`, `sourceDrv` (the OCI image derivation to realise and push).
8181
- **`HealthCheck`** (`:54`): `description`, `command` (argv), `timeoutSec`,

examples/dev-fleet/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Dev fleet
1+
# ix fleet
22

3-
A forkable dev environment (RFC 0007). One [`dev.nix`](dev.nix) - an ordinary
3+
A forkable ix environment (RFC 0007). One [`ix.nix`](ix.nix) - an ordinary
44
NixOS module - is the source of truth for the per-VM environment, the fleet
55
topology, and an opt-in shared SMB volume that gives the whole fleet one Claude
66
(and ix) login.
@@ -12,13 +12,13 @@ ix up
1212
```
1313

1414
This example declares a multi-node `ix.dev.fleet`. Omit that block and the same
15-
`dev.nix` is a **single VM named `dev`** that `ix up` (or `nix run .#up` in the
16-
forkable [template](../../templates/dev)) builds and creates - the simplest way
17-
to consume a `dev.nix` for one new VM. The fleet below is the scale-up.
15+
`ix.nix` is a **single VM named `dev`** that `ix up` (or `nix run .#up` in the
16+
forkable [template](../../templates/ix)) builds and creates - the simplest way
17+
to consume an `ix.nix` for one new VM. The fleet below is the scale-up.
1818

1919
## Shape
2020

21-
- [`dev.nix`](dev.nix) is the module a user edits after `ix dev init`. Top-level
21+
- [`ix.nix`](ix.nix) is the module a user edits after `ix init`. Top-level
2222
NixOS config (`environment.systemPackages`, `programs.git.enable`) is the
2323
environment; `ix.dev.fleet` is the topology; `ix.dev.shared` turns on the
2424
identity volume. Claude Code and Codex are installed by default.

examples/dev-fleet/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{ index }:
22

3-
# `mkDev` consumes the dev module in ./dev.nix and returns the same shape as
3+
# `mkDev` consumes the ix module in ./ix.nix and returns the same shape as
44
# `mkFleet`, so `ix up` / `nix run .#dev-fleet-up` work unchanged. `src = ./.`
55
# is what the template's flake.nix passes as the flake `self`; it is what gets
66
# materialized at /ix on every node for recursion.
77
index.lib.mkDev {
8-
module = ./dev.nix;
8+
module = ./ix.nix;
99
src = ./.;
1010
}

examples/dev-fleet/ix.nix

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# A forkable ix environment (RFC 0007). This is an ordinary NixOS module: write
2+
# your environment at the top level, and use `ix.dev.*` for the fleet and the
3+
# shared volume. After `ix init` this is the one file you edit.
4+
{ pkgs, ... }:
5+
{
6+
# Your environment - applied to every VM (single or fleet).
7+
environment.systemPackages = [
8+
pkgs.ripgrep
9+
pkgs.jq
10+
];
11+
programs.git.enable = true;
12+
13+
# Claude Code + Codex are installed by default; toggle either off here.
14+
# ix.dev.agents.codex = false;
15+
16+
# A fleet: two interchangeable agents plus a builder that opts out of the
17+
# shared volume below. Drop `ix.dev.fleet` entirely for a single VM.
18+
ix.dev.fleet = {
19+
agent.replicas = 2;
20+
builder.dependsOn = [ "agent" ];
21+
};
22+
23+
# One shared Claude (and ix) login for the fleet, over an SMB volume. The
24+
# first `claude login` on any agent logs in every agent; `builder` opts out.
25+
ix.dev.shared = {
26+
enable = true;
27+
ix = true; # also share ~/.n so a node can spawn more VMs (claude is shared by default)
28+
excludeNodes = [ "builder" ];
29+
};
30+
}

flake.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@
342342
};
343343
};
344344
overlays.default = ix.overlay;
345-
templates.dev = {
346-
path = ./templates/dev;
347-
description = "Forkable ix dev environment: one dev.nix for a default VM, a fleet, and shared Claude/ix auth (RFC 0007)";
345+
templates.ix = {
346+
path = ./templates/ix;
347+
description = "Forkable ix environment: one ix.nix for a default VM, a fleet, and shared Claude/ix auth";
348348
};
349349
packages = collect "packages";
350350
checks = collect "checks";

lib/dev/options.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
The `ix.dev.*` option surface (RFC 0007).
33
4-
This is what lets a forked `dev.nix` read like an ordinary NixOS module: you
4+
This is what lets a forked `ix.nix` read like an ordinary NixOS module: you
55
write `environment.systemPackages` and `programs.git.enable` at the top level
66
as usual, and reach for `ix.dev.*` only to describe the agents, the fleet
77
shape, and the shared identity volume. `mkDev` reads these options to plan the

lib/image/dev.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/**
22
`mkDev`: an opinionated dev-fleet layer over `mkFleet` (RFC 0007).
33
4-
Consumes one user-owned NixOS module (the forkable `dev.nix`) and returns the
4+
Consumes one user-owned NixOS module (the forkable `ix.nix`) and returns the
55
same result shape `mkFleet` does (`.up`, `.health`, `.diff`, `withNodePrefix`,
66
…), so it drops straight into the flake/example plumbing.
77
8-
The user's `dev.nix` is an ordinary NixOS module: `environment.systemPackages`
8+
The user's `ix.nix` is an ordinary NixOS module: `environment.systemPackages`
99
and friends at the top level, plus `ix.dev.*` (see `lib/dev/options.nix`) to
1010
describe the agents, fleet, and shared volume. `mkDev` reads `ix.dev` once via
1111
a probe eval to plan the fleet, then builds each node with the same module:
@@ -24,7 +24,7 @@
2424
Curried `mkDevFor hostSystem { module, src }` so flake/example evaluation can
2525
build the wrapper derivations for the requested system, mirroring `mkFleetFor`.
2626
`src` is the flake `self`, threaded in by the template's `flake.nix`; it is
27-
what gets materialized at `/ix`. The user's `dev.nix` never mentions it.
27+
what gets materialized at `/ix`. The user's `ix.nix` never mentions it.
2828
*/
2929
{
3030
lib,
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
# My ix dev environment
1+
# My ix environment
22

3-
A forkable dev VM config (RFC 0007). [`dev.nix`](dev.nix) is an ordinary NixOS
3+
A forkable ix VM config (RFC 0007). [`ix.nix`](ix.nix) is an ordinary NixOS
44
module that is the source of truth for your VM environment, an optional fleet,
55
and an optional shared SMB volume that gives a fleet one Claude (and ix) login.
66

77
## Start
88

99
```sh
10-
nix flake init -t github:indexable-inc/index#dev
10+
nix flake init -t github:indexable-inc/index#ix
1111
```
1212

13-
Then edit [`dev.nix`](dev.nix): write your environment at the top level
13+
Then edit [`ix.nix`](ix.nix): write your environment at the top level
1414
(`environment.systemPackages`, `programs.*`, `services.*`), and use `ix.dev.*`
1515
for the agents, a `fleet`, and a `shared` volume. Commit it to your own repo and
1616
fork it freely. `flake.nix` is boilerplate you should not need to touch.
1717

1818
## Use
1919

2020
Out of the box (no `ix.dev.fleet` declared) this config is a **single VM named
21-
`dev`**. One command builds `dev.nix` into an OCI image and creates that VM:
21+
`dev`**. One command builds `ix.nix` into an OCI image and creates or updates that VM:
2222

2323
```sh
2424
nix run .#up
2525
```
2626

27-
That is the "consume my `dev.nix` for a new VM" path: `nix run .#up` realises
28-
the image from your config and creates the VM through the same call `ix new`
29-
uses. Re-run it after editing `dev.nix` to roll the VM forward.
27+
That is the "consume my `ix.nix` for a new VM" path: `nix run .#up` realises
28+
the image from your config and creates or updates the VM through `ix up`. Re-run it after editing `ix.nix` to roll the VM forward.
3029

3130
Declare nodes under `ix.dev.fleet` and the same command brings up the whole
3231
fleet instead. The other verbs mirror `ix fleet <sub>`:
@@ -48,5 +47,4 @@ first `claude login` on any node logs in the whole fleet, and a new replica
4847
needs no extra auth. Add `ix.dev.shared.ix = true` to also share `~/.n` so a
4948
node can spin up more VMs from `/ix`.
5049

51-
> Default for new VMs: pointing a bare `ix up` at this config (`ix dev use`) is
52-
> wired in the `ix` CLI; see RFC 0007. Until then, use `nix run .#up`.
50+
> Default VM path: `ix up` should discover `./ix.nix`; until that CLI path lands, use `nix run .#up`.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
description = "My ix dev environment (RFC 0007)";
2+
description = "My ix environment (RFC 0007)";
33

44
inputs.index.url = "github:indexable-inc/index";
55
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -25,13 +25,13 @@
2525
# declared); `.#health` / `.#diff` / `.#down` mirror `ix fleet <sub>`.
2626
# `<node>-system` is each node's system closure.
2727
#
28-
# `module = ./dev.nix` is your config. `src = self` is the source
28+
# `module = ./ix.nix` is your config. `src = self` is the source
2929
# materialized at /ix on every node so a VM can rebuild itself - keep it.
3030
packages = forEach (
3131
system:
3232
let
3333
dev = index.lib.mkDevFor system {
34-
module = ./dev.nix;
34+
module = ./ix.nix;
3535
src = self;
3636
};
3737
in
@@ -52,7 +52,7 @@
5252
# ix VM closures are x86_64-linux, so the configs come from that builder.
5353
inherit
5454
(index.lib.mkDevFor "x86_64-linux" {
55-
module = ./dev.nix;
55+
module = ./ix.nix;
5656
src = self;
5757
})
5858
nixosConfigurations
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Your ix dev environment (RFC 0007).
1+
# Your ix environment (RFC 0007).
22
#
33
# This is an ordinary NixOS module. Write your environment at the top level the
44
# way you would any NixOS config; reach for `ix.dev.*` only to describe the

0 commit comments

Comments
 (0)