16 activationScript = config.system.activationScripts.script;
17 dryActivationScript = config.system.dryActivationScript;
23 system.activatable = mkOption {
27 Whether to add the activation script to the system profile.
29 The default, to have the script available all the time, is what we normally
30 do, but for image based systems, this may not be needed or not be desirable.
33 system.activatableSystemBuilderCommands = options.system.systemBuilderCommands // {
35 Like `system.systemBuilderCommands`, but only for the commands that are
36 needed *both* when the system is activatable and when it isn't.
38 Disclaimer: This option might go away in the future. It might be
39 superseded by separating switch-to-configuration into a separate script
40 which will make this option superfluous. See
41 https://github.com/NixOS/nixpkgs/pull/263462#discussion_r1373104845 for
45 system.build.separateActivationScript = mkOption {
48 A separate activation script package that's not part of the system profile.
50 This is useful for configurations where `system.activatable` is `false`.
51 Otherwise, you can just use `system.build.toplevel`.
56 system.activatableSystemBuilderCommands = ''
57 echo "$activationScript" > $out/activate
58 echo "$dryActivationScript" > $out/dry-activate
59 substituteInPlace $out/activate --subst-var-by out ''${!toplevelVar}
60 substituteInPlace $out/dry-activate --subst-var-by out ''${!toplevelVar}
61 chmod u+x $out/activate $out/dry-activate
62 unset activationScript dryActivationScript
65 system.systemBuilderCommands = lib.mkIf config.system.activatable config.system.activatableSystemBuilderCommands;
66 system.systemBuilderArgs = lib.mkIf config.system.activatable (
73 system.build.separateActivationScript =
74 pkgs.runCommand "separate-activation-script"
78 toplevelVar = "toplevel";
79 toplevel = config.system.build.toplevel;
84 ${config.system.activatableSystemBuilderCommands}