NixOS already implements both layers for software: a declarative config describes desired state, nix-build compiles it into system actions. Continuous Assembly needs the same for physical systems.

Ref

NixOS is a particular case of a desired state system: the OS is the mutable imperative layer, the config file is the desired state, and nix-build is the reconciliation step.