aboutsummaryrefslogtreecommitdiffstats
path: root/layers/nix.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-25 23:00:24 +0000
committertv <tv@krebsco.de>2026-11-26 00:03:17 +0000
commit7205cdf2e4bd7c05ee31d98324732b430dbfc53d (patch)
tree40d3eb23dacec73ae2c28da1f1b5a769a831ff91 /layers/nix.nix
parent25100d8884da14c48bfac12753e820be04028a05 (diff)
rigs: the guest's names, rig.* and rig-*
The project is called rigs now, as it runs its VMs in Cloud Hypervisor, too, not only Firecracker. So the guest's options (rig.secrets, rig.home.required, rig.nix, ...), its kernel command line (rig.vmm, rig.home, rig.xchg, rig.registration, rig.9pPORT), its units (rig-secrets, rig-home, rig-xchg, rig-vmm-exit, rig-drop-caches, rig-rw-store-unshadow), the drives' labels (rig-layer-K, rig-store, rig-home; the run script relabels existing store and home images), and the images (rig-layer-K.img) lose the fc and firecracker. Firecracker itself, the VMM, keeps its name.
Diffstat (limited to 'layers/nix.nix')
-rw-r--r--layers/nix.nix32
1 files changed, 16 insertions, 16 deletions
diff --git a/layers/nix.nix b/layers/nix.nix
index 68ee2c5..dee6a4d 100644
--- a/layers/nix.nix
+++ b/layers/nix.nix
@@ -5,11 +5,11 @@
# its images, read-only. With it, the run script requires --store.
{ config, lib, pkgs, ... }:
let
- lowerdir = config.fc.storeLowerdirs;
+ lowerdir = config.rig.storeLowerdirs;
in
{
nix.enable = true;
- fc.nix = true;
+ rig.nix = true;
# The store, on top of the guest's own closure from images (which reading
# is much faster than reading the host's store): the host's store,
@@ -27,7 +27,7 @@ in
neededForBoot = true;
};
fileSystems."/nix/.rw-store" = {
- device = "/dev/disk/by-label/fc-store"; # see the run script
+ device = "/dev/disk/by-label/rig-store"; # see the run script
fsType = "ext4";
options = [ "noatime" ];
noCheck = true;
@@ -50,8 +50,8 @@ in
};
# The images are an overlay already: this is one image more than the
# base system, so there are at least two.
- fc.storeLowerdirs = [ "/nix/.host-store" ];
- # The upper layer, which fc-rw-store-unshadow (below) creates.
+ rig.storeLowerdirs = [ "/nix/.host-store" ];
+ # The upper layer, which rig-rw-store-unshadow (below) creates.
fileSystems."/nix/store" = {
depends = [ "/nix/.rw-store" ];
options = [ "upperdir=/sysroot/nix/.rw-store/store" "workdir=/sysroot/nix/.rw-store/work" ];
@@ -68,7 +68,7 @@ in
# the guest's nix still has it registered (then nix-store --verify
# fails): drop only whiteouts, which would hide the host's path, and
# keep real copies.
- boot.initrd.systemd.services.fc-rw-store-unshadow = {
+ boot.initrd.systemd.services.rig-rw-store-unshadow = {
requiredBy = [ "sysroot-nix-store.mount" ];
before = [ "sysroot-nix-store.mount" ];
unitConfig.DefaultDependencies = false;
@@ -93,12 +93,12 @@ in
'';
};
# For the host's store, in the initrd.
- boot.initrd.systemd.extraBin."mount.vsock9p" = config.fc.mountVsock9p;
+ boot.initrd.systemd.extraBin."mount.vsock9p" = config.rig.mountVsock9p;
boot.initrd.systemd.storePaths = [ pkgs.socat pkgs.util-linux ];
# nix, with the host's nixpkgs for nix-shell -p and the like, at
# /nixpkgs (see below). Root goes through the daemon too, so the
- # paths of the guest's closure get registered (fc.registration, see
+ # paths of the guest's closure get registered (rig.registration, see
# the run script) before anything uses the store, and only once
# something does, not at boot. The rest of the host's store is
# there, too, but not registered.
@@ -116,7 +116,7 @@ in
# needing one of them fails, and says why.
script = ''
for arg in $(cat /proc/cmdline); do
- case $arg in fc.registration=*)
+ case $arg in rig.registration=*)
${config.nix.package.out}/bin/nix-store --load-db < "''${arg#*=}"
esac
done
@@ -136,13 +136,13 @@ in
# --nixpkgs-cache=loose) never asks the host again: a file changed on
# the host keeps its old size and contents in the guest, and a name
# looked up before the host had it stays missing, until the guest drops
- # its cached dentries and inodes, which fc-drop-caches lets anyone do
+ # its cached dentries and inodes, which rig-drop-caches lets anyone do
# (setuid; no input, it only ever writes 2 to drop_caches).
- security.wrappers.fc-drop-caches = {
+ security.wrappers.rig-drop-caches = {
setuid = true;
owner = "root";
group = "root";
- source = lib.getExe (pkgs.writeCBin "fc-drop-caches" ''
+ source = lib.getExe (pkgs.writeCBin "rig-drop-caches" ''
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
@@ -150,7 +150,7 @@ in
sync();
int fd = open("/proc/sys/vm/drop_caches", O_WRONLY);
if (fd < 0 || write(fd, "2\n", 2) != 2) {
- perror("fc-drop-caches: /proc/sys/vm/drop_caches");
+ perror("rig-drop-caches: /proc/sys/vm/drop_caches");
return 1;
}
return 0;
@@ -159,7 +159,7 @@ in
};
# And the run script has it done via vsock port 1235 when the host's
# nixpkgs checkout changes its commit (with --nixpkgs-cache).
- systemd.sockets.fc-drop-caches = {
+ systemd.sockets.rig-drop-caches = {
wantedBy = [ "sockets.target" ];
socketConfig = {
ListenStream = "vsock::1235";
@@ -167,8 +167,8 @@ in
MaxConnections = 1;
};
};
- systemd.services."fc-drop-caches@" = {
+ systemd.services."rig-drop-caches@" = {
serviceConfig.StandardInput = "socket";
- script = "/run/wrappers/bin/fc-drop-caches";
+ script = "/run/wrappers/bin/rig-drop-caches";
};
}