aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-25 23:02:17 +0000
committertv <tv@krebsco.de>2026-11-26 00:03:17 +0000
commit23df3da867ec9297f1050dcca14103fddca2153d (patch)
tree19e125547d76c5cbd954a11d547e2012de22b104
parent7205cdf2e4bd7c05ee31d98324732b430dbfc53d (diff)
rigs: run-rig, not run-firecracker-vm
The run script starts its VMs in Cloud Hypervisor, too, so it's pkgs/run-rig, and run-rig (also its lock files), and the examples' paths are /path/to/rigs.
-rw-r--r--README.md38
-rw-r--r--base/kernel.nix4
-rw-r--r--base/systemd.nix2
-rw-r--r--layers/console.nix2
-rw-r--r--layers/switch.nix4
-rw-r--r--modules/host/default.nix10
-rw-r--r--pkgs/run-rig/default.nix (renamed from pkgs/run-firecracker-vm/default.nix)12
-rw-r--r--tests/qemu/default.nix4
8 files changed, 38 insertions, 38 deletions
diff --git a/README.md b/README.md
index f9e32de..66e9ed1 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ In the host's NixOS configuration:
```nix
imports = [
- (import /path/to/firecracker/modules/host { users = { tv = 8; alice = 2; }; })
+ (import /path/to/rigs/modules/host { users = { tv = 8; alice = 2; }; })
];
```
@@ -76,8 +76,8 @@ tcp 10080 (the checks).
## Running a VM
```sh
-nix-build pkgs/run-firecracker-vm
-./result/bin/run-firecracker-vm
+nix-build pkgs/run-rig
+./result/bin/run-rig
```
The guest's console (the run script's terminal) shows the kernel's and
@@ -88,7 +88,7 @@ needs a password). It's small, so rather than a layer, with an image,
of its own, import it into another layer:
```nix
-{ imports = [ /path/to/firecracker/layers/console.nix ]; }
+{ imports = [ /path/to/rigs/layers/console.nix ]; }
```
(As a layer of its own, it works, too: `--arg layers '[ layers/console.nix ]'`.)
@@ -106,7 +106,7 @@ nix layer, preferably first, so its image is the same for all guests
with nix (see layers below):
```sh
-nix-build pkgs/run-firecracker-vm --arg layers '[ layers/nix.nix ./my-service.nix ]'
+nix-build pkgs/run-rig --arg layers '[ layers/nix.nix ./my-service.nix ]'
```
What nix in such a guest adds to the store goes to a disk of its own,
@@ -114,7 +114,7 @@ which the run script then requires (and refuses for a guest without nix,
like `--nixpkgs` and `--nixpkgs-cache`, below):
```sh
-./result/bin/run-firecracker-vm --store ~/fc-store.img [--store-size 50G]
+./result/bin/run-rig --store ~/fc-store.img [--store-size 50G]
```
The file gets created (sparse, default 16G) if it doesn't exist. Only one
@@ -123,7 +123,7 @@ unless given a disk of its own, which works the same way (kept apart
from the store, so either can be kept or thrown away):
```sh
-./result/bin/run-firecracker-vm --home ~/fc-home.img [--home-size 50G]
+./result/bin/run-rig --home ~/fc-home.img [--home-size 50G]
```
For a faster development loop, a guest with nix can switch to a new
@@ -132,7 +132,7 @@ into a layer. Build the system with the same arguments as the guest,
and switch to it:
```sh
-sys=$(nix-build --no-out-link pkgs/run-firecracker-vm -A toplevel --arg layers '[ layers/nix.nix ./my-service.nix ]')
+sys=$(nix-build --no-out-link pkgs/run-rig -A toplevel --arg layers '[ layers/nix.nix ./my-service.nix ]')
ssh root@VM $sys/bin/switch-to-configuration test
```
@@ -189,9 +189,9 @@ ssh_host_ed25519_key=FILE` (an ed25519 private key without passphrase).
With the same one for all your guests, one known_hosts line does:
```sh
-ssh-keygen -t ed25519 -N "" -f ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key
-echo "172.16.0.*,fdfc:fc::* $(cut -d' ' -f1,2 ~/.local/share/run-firecracker-vm/ssh_host_ed25519_key.pub)" >> ~/.ssh/known_hosts
-./result/bin/run-firecracker-vm --secret ssh_host_ed25519_key=$HOME/.local/share/run-firecracker-vm/ssh_host_ed25519_key
+ssh-keygen -t ed25519 -N "" -f ~/.local/share/run-rig/ssh_host_ed25519_key
+echo "172.16.0.*,fdfc:fc::* $(cut -d' ' -f1,2 ~/.local/share/run-rig/ssh_host_ed25519_key.pub)" >> ~/.ssh/known_hosts
+./result/bin/run-rig --secret ssh_host_ed25519_key=$HOME/.local/share/run-rig/ssh_host_ed25519_key
```
Who may log in goes in a layer, e.g.:
@@ -216,7 +216,7 @@ and the run script, which doesn't start the guest without them, gets
them with `--secret NAME=FILE` (FILE read once, so a pipe will do):
```sh
-./result/bin/run-firecracker-vm --secret hermes.env=<(pass show hermes/env)
+./result/bin/run-rig --secret hermes.env=<(pass show hermes/env)
```
They're only that guest's, and only in its memory (`/run`), until it
@@ -227,7 +227,7 @@ The guest's system can be built in layers, each a NixOS module on top of
the ones before (the first on top of the base system):
```sh
-nix-build pkgs/run-firecracker-vm --arg layers '[ ./base-tools.nix ./my-service.nix ]'
+nix-build pkgs/run-rig --arg layers '[ ./base-tools.nix ./my-service.nix ]'
```
The guest runs the top layer's system. Each layer gets its own image,
@@ -244,7 +244,7 @@ image. So to use a cut-down kernel, based on Firecracker's recommended
guest configuration, instead of `linuxPackages_latest`:
```sh
-nix-build pkgs/run-firecracker-vm \
+nix-build pkgs/run-rig \
--arg base '[ base/kernel.nix ]'
```
@@ -253,7 +253,7 @@ cryptsetup, TPM2, FIDO2, journal-remote, ...), built from source, with
dbus and dbus-broker against it:
```sh
-nix-build pkgs/run-firecracker-vm \
+nix-build pkgs/run-rig \
--arg base '[ base/kernel.nix base/systemd.nix ]'
```
@@ -285,8 +285,8 @@ named like the VM, else (no name) `default`:
```sh
fc-egress -l box allow https://cache.nixos.org
-./result/bin/run-firecracker-vm --name box # list box
-./result/bin/run-firecracker-vm --name box2 --egress box # list box, too
+./result/bin/run-rig --name box # list box
+./result/bin/run-rig --name box2 --egress box # list box, too
fc-egress vms # running VMs: tap (as in the log), address, name, list
fc-egress -v box allow https://example.org # the list box uses
fc-egress use box default # switch box to another list
@@ -333,8 +333,8 @@ the list its own VM uses.
## Layout
-- `pkgs/run-firecracker-vm/default.nix`: the guest's NixOS configuration,
- the Firecracker configuration, and the `run-firecracker-vm` script.
+- `pkgs/run-rig/default.nix`: the guest's NixOS configuration,
+ the Firecracker configuration, and the `run-rig` script.
- `base/kernel.nix`: the cut-down kernel, for `base`.
- `base/systemd.nix`: a slimmer systemd, for `base`.
- `layers/nix.nix`: nix, as a layer.
diff --git a/base/kernel.nix b/base/kernel.nix
index 6646d33..38e38f2 100644
--- a/base/kernel.nix
+++ b/base/kernel.nix
@@ -1,8 +1,8 @@
# Cut-down guest kernel, based on Firecracker's recommended configuration,
# as a module for the base system:
-# nix-build pkgs/run-firecracker-vm --arg base '[ base/kernel.nix ]'
+# nix-build pkgs/run-rig --arg base '[ base/kernel.nix ]'
# With erofs and 9P (for the store), KVM as modules, which load when
-# the VMM offers hardware virtualization (run-firecracker-vm --nested),
+# the VMM offers hardware virtualization (run-rig --nested),
# and what modules/host needs of nf_tables (inet, IPv6 and bridge
# families, ct count, limit, log, reject, fib, redirect, masquerade), so
# a guest can run guests, too.
diff --git a/base/systemd.nix b/base/systemd.nix
index 1bb0d0f..cd2c789 100644
--- a/base/systemd.nix
+++ b/base/systemd.nix
@@ -1,6 +1,6 @@
# A slimmer systemd, without what a guest has no use for, as a module for
# the base system:
-# nix-build pkgs/run-firecracker-vm --arg base '[ base/systemd.nix ]'
+# nix-build pkgs/run-rig --arg base '[ base/systemd.nix ]'
# Built from source (no binary cache has it), on every nixpkgs bump, as are
# dbus, against it instead of systemd-minimal (which comes in only with
# dbus), and without X11 and AppArmor, and dbus-broker, which links
diff --git a/layers/console.nix b/layers/console.nix
index 417b761..135e483 100644
--- a/layers/console.nix
+++ b/layers/console.nix
@@ -3,7 +3,7 @@
# user, or null for a login prompt, which needs a password). Small, so
# better imported by another layer than a layer, with an image, of its
# own:
-# imports = [ /path/to/firecracker/layers/console.nix ];
+# imports = [ /path/to/rigs/layers/console.nix ];
# though that works, too:
# --arg layers '[ layers/console.nix ./my-layer.nix ]'
# Without it, the guest has no console (no getty, no kbd), and the way in
diff --git a/layers/switch.nix b/layers/switch.nix
index c1c5155..458026f 100644
--- a/layers/switch.nix
+++ b/layers/switch.nix
@@ -5,9 +5,9 @@
# script, whose images have the new system. Needs layers/nix.nix (the
# guest sees the host's store, where the new system gets built). Small,
# so better imported by another layer:
-# imports = [ /path/to/firecracker/layers/switch.nix ];
+# imports = [ /path/to/rigs/layers/switch.nix ];
# Then, on the host, with the same arguments as the running guest's build:
-# sys=$(nix-build --no-out-link pkgs/run-firecracker-vm -A toplevel ...)
+# sys=$(nix-build --no-out-link pkgs/run-rig -A toplevel ...)
# ssh root@VM $sys/bin/switch-to-configuration test
# A store path that the guest looked for before the host had it stays
# missing in the guest's store (the overlay remembers), until the guest
diff --git a/modules/host/default.nix b/modules/host/default.nix
index 6e20219..cfb050a 100644
--- a/modules/host/default.nix
+++ b/modules/host/default.nix
@@ -25,7 +25,7 @@
# whitelist (see egress.lua):
# whole domains get passed through to port 443 of that name, as resolved
# by the host; domains with path rules get decrypted (with certificates
-# from our own CA, which the guests trust, see pkgs/run-firecracker-vm)
+# from our own CA, which the guests trust, see pkgs/run-rig)
# and only matching requests forwarded.
#
# Whitelists are per user and named: /var/lib/fc-egress/USER/LIST, changed
@@ -121,7 +121,7 @@
vmDir = "/run/fc-egress"; # TAP: the name of the VM's list
# List names: no slashes, no dot files.
listName = "[A-Za-z0-9_-]+";
- # VM names (run-firecracker-vm --name, also the guest's host name):
+ # VM names (run-rig --name, also the guest's host name):
# /run/fc-egress/TAP.name, for fc-egress.
vmName = "[A-Za-z0-9][A-Za-z0-9-]{0,62}";
userNames = lib.attrNames users;
@@ -299,7 +299,7 @@ ${lib.concatMapStrings (v: " \"${v.user} ${v.vm}\") vip=${v.ip} vip6=${
};
# Where nginx keeps the CA: ca.key, and ca.pem for the guests (see
- # caCert in pkgs/run-firecracker-vm).
+ # caCert in pkgs/run-rig).
stateDir = "/var/lib/fcbr0-egress";
runDir = "/run/fcbr0-egress";
@@ -320,9 +320,9 @@ ${lib.concatMapStrings (v: " \"${v.user} ${v.vm}\") vip=${v.ip} vip6=${
echo " fc-egress use VM LIST"
echo " fc-egress log [JOURNALCTL-OPTION...]"
echo "LIST is a whitelist's name (default: default); a VM uses the one"
- echo " given to run-firecracker-vm --egress (default: its --name,"
+ echo " given to run-rig --egress (default: its --name,"
echo " or default)"
- echo "VM is a running VM's name (run-firecracker-vm --name) or tap;"
+ echo "VM is a running VM's name (run-rig --name) or tap;"
echo " -v VM means the list it uses"
echo "RULE is https://DOMAIN (with subdomains, not decrypted)"
echo " or https://DOMAIN/PATH (decrypted to check the path: PATH itself,"
diff --git a/pkgs/run-firecracker-vm/default.nix b/pkgs/run-rig/default.nix
index 7c0235b..16af39d 100644
--- a/pkgs/run-firecracker-vm/default.nix
+++ b/pkgs/run-rig/default.nix
@@ -115,7 +115,7 @@ let
{ fileSystems = imageFileSystems (n + 1); }
{ systemd.generators.rig-home = homeGenerator (label "rig-home"); }
# /xchg: a directory of the host's, via 9P on vsock port 564, only
- # with rig.xchg on the kernel command line (run-firecracker-vm
+ # with rig.xchg on the kernel command line (run-rig
# --xchg DIR), mounted when first used. A generator, so a guest
# without it has no /xchg at all.
{ systemd.generators.rig-xchg = pkgs.writeShellScript "rig-xchg-generator" ''
@@ -213,7 +213,7 @@ let
nix.enable = lib.mkDefault false;
assertions = [{
assertion = config.nix.enable == config.rig.nix;
- message = "nix.enable: use run-firecracker-vm's layers/nix.nix instead.";
+ message = "nix.enable: use run-rig's layers/nix.nix instead.";
}] ++ lib.mapAttrsToList (name: s: {
assertion = builtins.match "[A-Za-z0-9._-]+" name != null
&& builtins.match "/run/[^ ]+" s.path != null;
@@ -555,8 +555,8 @@ let
];
});
in
-pkgs.writeShellScriptBin "run-firecracker-vm" /* sh */ ''
- # usage: run-firecracker-vm [--store FILE] [--store-size SIZE]
+pkgs.writeShellScriptBin "run-rig" /* sh */ ''
+ # usage: run-rig [--store FILE] [--store-size SIZE]
# [--home FILE] [--home-size SIZE]
# [--mem-size MIB]
# [--nixpkgs DIR] [--nixpkgs-cache MODE]
@@ -798,7 +798,7 @@ pkgs.writeShellScriptBin "run-firecracker-vm" /* sh */ ''
while read -r t u a m; do
test "$u" = "$me" || continue
test "$(cat /sys/class/net/$t/owner 2>/dev/null)" = "$(id -u)" || continue
- exec {lock}>"$lockdir/run-firecracker-vm.$t.lock"
+ exec {lock}>"$lockdir/run-rig.$t.lock"
if flock -n "$lock"; then
locks+=("$lock")
tap=$t
@@ -829,7 +829,7 @@ pkgs.writeShellScriptBin "run-firecracker-vm" /* sh */ ''
echo "$0: bad name: $name (letters, digits and -, not like a tap)" >&2
exit 1
fi
- exec {name_lock}>"$lockdir/run-firecracker-vm.name.$name.lock"
+ exec {name_lock}>"$lockdir/run-rig.name.$name.lock"
if ! flock -n "$name_lock"; then
echo "$0: a VM named $name is running already" >&2
exit 1
diff --git a/tests/qemu/default.nix b/tests/qemu/default.nix
index 82c7de6..29ff093 100644
--- a/tests/qemu/default.nix
+++ b/tests/qemu/default.nix
@@ -2,7 +2,7 @@
# for testing without Firecracker (fast with /dev/kvm, else under TCG).
#
# nix-build tests/qemu --argstr script 'echo TEST $(nproc); systemctl poweroff'
-# ./result/bin/run-firecracker-vm --secret ssh_host_ed25519_key=KEY [OPTION...] | tee log
+# ./result/bin/run-rig --secret ssh_host_ed25519_key=KEY [OPTION...] | tee log
#
# script: a shell script run as root at the end of boot (see debug.nix);
# end it with `systemctl poweroff` for the guest to exit, or leave it out
@@ -19,7 +19,7 @@ let
text = builtins.readFile ./firecracker.sh;
};
in
-import ../../pkgs/run-firecracker-vm (builtins.removeAttrs args [ "script" "layers" ] // {
+import ../../pkgs/run-rig (builtins.removeAttrs args [ "script" "layers" ] // {
pkgs = pkgs.extend (_: _: { inherit firecracker; });
layers = layers ++ [ (import ./debug.nix script) ];
})