0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +03:00

nixos/activation: pass the action as an argument to the pre-switch-checks

This allows for instance to reject switching into a configuration, while
still allowing to reboot into that same configuration.

This can be useful for instance to reject switching to a configuration
with a new systemd major version, but setting that same configuration as
the new boot default with `switch-to-configuration boot` is fine.
This commit is contained in:
r-vdp 2025-01-28 11:40:38 +01:00
parent 0c598375d8
commit e6bc540ce0
No known key found for this signature in database
3 changed files with 8 additions and 5 deletions

View file

@ -103,7 +103,7 @@ if (($ENV{"NIXOS_NO_CHECK"} // "") ne "1") {
chomp(my $pre_switch_checks = <<'EOFCHECKS');
@preSwitchCheck@
EOFCHECKS
system("$pre_switch_checks $out") == 0 or exit 1;
system("$pre_switch_checks $out $action") == 0 or exit 1;
if ($action eq "check") {
exit 0;
}