diff --git a/modules/system/activation/switch-to-configuration.pl b/modules/system/activation/switch-to-configuration.pl new file mode 100644 index 000000000000..199c23d8ab0e --- /dev/null +++ b/modules/system/activation/switch-to-configuration.pl @@ -0,0 +1,57 @@ +#! @perl@ + +use strict; +use warnings; +use File::Slurp; + +my $action = shift @ARGV; + +if (!defined $action || ($action ne "switch" && $action ne "boot" && $action ne "test")) { + print STDERR < 'quiet') // ""; +my $newVersion = read_file("@out@/init-interface-version"); + +if ($newVersion ne $oldVersion) { + print STDERR < $out/kernel-params @@ -130,7 +130,7 @@ let done mkdir $out/bin - substituteAll ${./switch-to-configuration.sh} $out/bin/switch-to-configuration + substituteAll ${./switch-to-configuration.pl} $out/bin/switch-to-configuration chmod +x $out/bin/switch-to-configuration ${config.system.extraSystemBuilderCmds} @@ -146,6 +146,9 @@ let name = "nixos-${config.system.nixosVersion}"; preferLocalBuild = true; buildCommand = systemBuilder; + + inherit (pkgs) systemd; + inherit children; kernelParams = config.boot.kernelParams ++ config.boot.extraKernelParams; @@ -164,17 +167,10 @@ let # to the activation script. noRestartIfChanged = attrValues (mapAttrs (n: v: if v.restartIfChanged then [] else ["[${v.name}]=1"]) config.jobs); - # Most of these are needed by grub-install. - path = - [ pkgs.coreutils - pkgs.gnused - pkgs.gnugrep - pkgs.findutils - pkgs.diffutils - pkgs.systemd - ]; - configurationName = config.boot.loader.grub.configurationName; + + # Needed by switch-to-configuration. + perl = "${pkgs.perl}/bin/perl -I${pkgs.perlPackages.FileSlurp}/lib/perl5/site_perl"; };