Expand description
Activation script generation — typed border for the cppnix
switch-to-configuration / darwin-rebuild / home-manager activate script generators.
Given an evaluated NixOS / nix-darwin / home-manager config, the activation phase produces a typed bundle:
- the activation script text (and its store path)
- the per-host generation metadata (number, hash, profile path)
- the realised closure of files in
/etc, systemd units, etc.
Today the cppnix Nix expressions in nixos-rebuild /
nix-darwin / home-manager produce this through hand-coded
pkgs.runCommand derivations. Per the spec pattern this module
names the typed contract: three algorithms, each authored as a
phase pipeline, drive the activation surface uniformly.
M2 status: typed border + Lisp spec; interpreter is the M3 step (depends on a working module system).
§Authoring surface
(defactivation-script-algorithm cppnix-darwin
:name "cppnix-darwin"
:target Darwin
:phases ((:kind ResolveSystemBuildToplevel)
(:kind GenerateLaunchdPlists)
(:kind GenerateEtcSymlinks)
(:kind ResolveSecretRefs)
(:kind ComposeActivationScript :bind "script")
(:kind WriteActivationDerivation :from "script")))Structs§
- Activation
Args - Inputs to an activation-script algorithm.
- Activation
Outcome - Result of an activation-script run.
- Activation
Phase - One phase of an activation pipeline. Same flat-kwarg shape as
crate::derivation::Phasefor visual + cognitive consistency. - Activation
Script Algorithm - One activation-script algorithm authored as
(defactivation-script-algorithm …). Variants bytargetmap to the three cppnix surfaces (NixOS, nix-darwin, home-manager).
Enums§
- Activation
Phase Kind - Closed set of activation phases. Adding a variant IS extending the spec language.
- Activation
Target - Which system surface the algorithm targets. The phase set is largely shared, but the launchd / systemd / per-user distinction determines a few platform-specific phases.
Constants§
Functions§
- apply
- Apply the activation algorithm. M3.0 implementation: walks the authored phase pipeline, dispatching each phase to a small text- generation routine. No actual filesystem writes — output is the activation script TEXT, ready to be written to a derivation. (M3.1 + sui-build will materialise the derivation.)
- load_
canonical - Compile the canonical activation specs. Returns one
ActivationScriptAlgorithmper target.