goose knows about nix

This commit is contained in:
ari committed 2026-11-01 15:21:43 -05:00
1 parent 25fcf85855
commit 25f648d606
8 files changed
+35 -11

No files matched your search

+11 -4
View File
@@ -34,7 +34,8 @@ const (
systemdMgr = "org.freedesktop.systemd1.Manager"
sigPoweroff = 38 // SIGRTMIN+4, what `machinectl poweroff` sends
agentEnvInside = "/var/lib/slackerbot/agent.env"
agentEnvInside = "/var/lib/slackerbot/agent.env"
nixDaemonSocket = "/nix/var/nix/daemon-socket"
)
type Local struct {
@@ -212,6 +213,9 @@ func (l *Local) Start(ctx context.Context, spec node.StartSpec) error {
f.Close()
}
if _, err := os.Stat(nixDaemonSocket); err != nil {
return fmt.Errorf("containers build through the host's nix-daemon, but %s is missing: %w", nixDaemonSocket, err)
}
envFile, err := l.writeEnvFile(spec)
if err != nil {
return err
@@ -234,9 +238,12 @@ func (l *Local) Start(ctx context.Context, spec node.StartSpec) error {
"--directory=" + root,
"--keep-unit",
"--network-veth", // own network, so every container can use port 1984
"--bind-ro=/nix/store",
"--bind-ro=" + envFile + ":" + agentEnvInside,
"--bind=" + home + ":/root",
// Container root is an unprivileged host uid, so the host nix-daemon treats it as untrusted.
"--private-users=pick",
"--bind-ro=/nix/store:/nix/store:idmap",
"--bind-ro=" + nixDaemonSocket,
"--bind-ro=" + envFile + ":" + agentEnvInside + ":idmap",
"--bind=" + home + ":/root:idmap",
}
binds := func(list []string, flag string) error {
for _, b := range list {