Skip to content

Commit 7c0c2e2

Browse files
committed
nixos: Add system.activation.externalActivationScript
1 parent a7a1438 commit 7c0c2e2

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

nixos/modules/system/activation/activation-script.nix

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,23 @@ in
137137
};
138138
};
139139

140+
system.activation.externalActivationScript = mkOption {
141+
description = ''
142+
Activation script for systems that are not managed by users of the system.
143+
144+
In this scenario, the activation script does not need to be part of the
145+
"top-level" system store path.
146+
147+
In the case of an image, this allows activation-only dependencies to
148+
be omitted from the runtime dependencies.
149+
150+
In case of a mutable system, it may allow a few dependencies to be
151+
to be garbage collected after activation.
152+
'';
153+
type = types.package;
154+
readOnly = true;
155+
};
156+
140157
system.dryActivationScript = mkOption {
141158
description = "The shell script that is to be run when dry-activating a system.";
142159
readOnly = true;
@@ -238,6 +255,14 @@ in
238255
rmdir --ignore-fail-on-non-empty /usr/bin /usr
239256
'';
240257

258+
system.activation.externalActivationScript =
259+
pkgs.writeScript "activate" (
260+
lib.strings.replaceStrings
261+
["@out@"]
262+
["${config.system.build.toplevel}"]
263+
config.system.activationScripts.script
264+
);
265+
241266
};
242267

243268
}

0 commit comments

Comments
 (0)