Skip to content

Commit

Permalink
nixos: Add system.activation.externalActivationScript
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Dec 9, 2021
1 parent a7a1438 commit 7c0c2e2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions nixos/modules/system/activation/activation-script.nix
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,23 @@ in
};
};

system.activation.externalActivationScript = mkOption {
description = ''
Activation script for systems that are not managed by users of the system.
In this scenario, the activation script does not need to be part of the
"top-level" system store path.
In the case of an image, this allows activation-only dependencies to
be omitted from the runtime dependencies.
In case of a mutable system, it may allow a few dependencies to be
to be garbage collected after activation.
'';
type = types.package;
readOnly = true;
};

system.dryActivationScript = mkOption {
description = "The shell script that is to be run when dry-activating a system.";
readOnly = true;
Expand Down Expand Up @@ -238,6 +255,14 @@ in
rmdir --ignore-fail-on-non-empty /usr/bin /usr
'';

system.activation.externalActivationScript =
pkgs.writeScript "activate" (
lib.strings.replaceStrings
["@out@"]
["${config.system.build.toplevel}"]
config.system.activationScripts.script
);

};

}

0 comments on commit 7c0c2e2

Please sign in to comment.