s6

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package s6 provides shared s6 service management primitives used by all three devcell engines (Docker/Linux, Tart/macOS, WinKit/Windows).

Services are defined in the community-home repo (modules/s6/) and compiled at image build time by s6-rc-compile into a binary database. At boot, s6-svscan starts the supervision tree and s6-rc brings services up in dependency order with parallel execution and readiness gating.

Index

Constants

View Source
const (
	EnvDir      = "/etc/s6/env"
	SourceDir   = "/etc/s6-rc/source"
	CompiledDir = "/etc/s6-rc/compiled"
	ScanDir     = "/run/service"
	LiveDir     = "/run/s6-rc"
	ReadyFile   = "/run/devcell-session-ready"

	// ServicesDir is the legacy path where nix renderers install service
	// source definitions. Kept as an alias for callers that log it.
	// Deprecated: use SourceDir for s6-rc source, CompiledDir for compiled DB.
	ServicesDir = SourceDir
)

Standard paths, shared across all engines.

Variables

This section is empty.

Functions

func ActivateScript

func ActivateScript(env SessionEnv) string

ActivateScript returns a shell script for Tart/macOS and WinKit engines. Same s6-rc boot sequence as EntrypointSnippet but with sudo (runs as non-root admin user) and nix-daemon profile sourcing.

func EntrypointSnippet

func EntrypointSnippet(env SessionEnv) string

EntrypointSnippet returns a shell snippet for Docker's init to activate s6 session services. Runs as root (no sudo), does not source nix-daemon profile (container image PATH is already set up).

Boot sequence:

  1. Write s6 envdir vars
  2. Create session user
  3. Start s6-svscan supervision tree (background)
  4. s6-rc-init: link compiled DB into live state
  5. s6-rc change user: bring up all services (parallel deps, readiness)
  6. Drop to session user via gosu

func LinuxExecPATH

func LinuxExecPATH(env SessionEnv) string

LinuxExecPATH returns the PATH string for docker exec sessions. Mirrors the PATH set by EntrypointSnippet so exec'd processes have the same tool visibility as the entrypoint-launched CMD.

func WSL1ExecPATH

func WSL1ExecPATH(env SessionEnv) string

WSL1ExecPATH returns the PATH string for commands executed in a WSL1 distro. Mirrors Docker's EntrypointSnippet PATH layout but omits Docker-specific entries (/run/wrappers/bin, devcell-tools).

func WriteEnvScript

func WriteEnvScript(env SessionEnv) string

WriteEnvScript returns a shell snippet that writes env to EnvDir. Each variable becomes a single file (s6 envdir format).

Types

type SessionEnv

type SessionEnv struct {
	HostUser    string // host $USER, e.g. "warden"
	SessionHome string // session user's home, e.g. "/Users/warden" or "/home/warden"
	DevcellHome string // nix profile owner's home, e.g. "/Users/devcell" or "/opt/devcell"
}

SessionEnv is the standard env var set written to the s6 envdir before activating session services. Every s6 service script reads these via `s6-envdir /etc/s6/env`.

func DarwinSessionEnv

func DarwinSessionEnv(cellUser, vmUser string) SessionEnv

DarwinSessionEnv builds a SessionEnv for macOS (Tart engine). cellUser is the session user (e.g. "warden"), vmUser owns the nix profile (e.g. "devcell").

func LinuxSessionEnv

func LinuxSessionEnv(hostUser string) SessionEnv

LinuxSessionEnv builds a SessionEnv for Docker/Linux containers.

func WSL1SessionEnv

func WSL1SessionEnv(hostUser string) SessionEnv

WSL1SessionEnv builds a SessionEnv for WinKit's WSL1 distro.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL