Skip to main content

Module activation_script

Module activation_script 

Source
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§

ActivationArgs
Inputs to an activation-script algorithm.
ActivationOutcome
Result of an activation-script run.
ActivationPhase
One phase of an activation pipeline. Same flat-kwarg shape as crate::derivation::Phase for visual + cognitive consistency.
ActivationScriptAlgorithm
One activation-script algorithm authored as (defactivation-script-algorithm …). Variants by target map to the three cppnix surfaces (NixOS, nix-darwin, home-manager).

Enums§

ActivationPhaseKind
Closed set of activation phases. Adding a variant IS extending the spec language.
ActivationTarget
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§

CANONICAL_ACTIVATION_LISP

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 ActivationScriptAlgorithm per target.