treewide: remove Perl-based switch-to-configuration
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
|
||||
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
|
||||
|
||||
- The Perl implementation of the `switch-to-configuration` program is removed. All switchable systems now use the Rust rewrite. Any prior usage of `system.switch.enableNg` must now be removed. If you have any outstanding issues with the new implementation, please open an issue on GitHub.
|
||||
|
||||
- The `services.polipo` module has been removed as `polipo` is unmaintained and archived upstream.
|
||||
|
||||
- The Pocket ID module ([`services.pocket-id`][#opt-services.pocket-id.enable]) and package (`pocket-id`) has been updated to 1.0.0. Some environment variables have been changed or removed, see the [migration guide](https://pocket-id.org/docs/setup/migrate-to-v1/).
|
||||
|
||||
@@ -256,7 +256,7 @@ in
|
||||
description = ''
|
||||
A program that writes a bootloader installation script to the path passed in the first command line argument.
|
||||
|
||||
See `nixos/modules/system/activation/switch-to-configuration.pl`.
|
||||
See `pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs`.
|
||||
'';
|
||||
type = types.unique {
|
||||
message = ''
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,17 +5,18 @@
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
perlWrapped = pkgs.perl.withPackages (
|
||||
p: with p; [
|
||||
ConfigIniFiles
|
||||
FileSlurp
|
||||
]
|
||||
);
|
||||
in
|
||||
{
|
||||
options.system.switch = {
|
||||
enable = lib.mkOption {
|
||||
imports = [
|
||||
(lib.mkRemovedOptionModule [ "system" "switch" "enableNg" ] ''
|
||||
This option controlled the usage of the new switch-to-configuration-ng,
|
||||
which is now the only switch-to-configuration implementation. This option
|
||||
can be removed from configuration. If there are outstanding issues
|
||||
preventing you from using the new implementation, please open an issue on
|
||||
GitHub.
|
||||
'')
|
||||
];
|
||||
|
||||
options.system.switch.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
@@ -29,58 +30,7 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
enableNg = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.system.switch.enable;
|
||||
defaultText = lib.literalExpression "config.system.switch.enable";
|
||||
description = ''
|
||||
Whether to use `switch-to-configuration-ng`, the Rust-based
|
||||
re-implementation of the original Perl `switch-to-configuration`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf (config.system.switch.enable && !config.system.switch.enableNg) {
|
||||
warnings = [
|
||||
''
|
||||
The Perl implementation of switch-to-configuration will be deprecated
|
||||
and removed in the 25.05 release of NixOS. Please migrate to the
|
||||
newer implementation by removing `system.switch.enableNg = false`
|
||||
from your configuration. If you are unable to migrate due to any
|
||||
issues with the new implementation, please create an issue and tag
|
||||
the maintainers of `switch-to-configuration-ng`.
|
||||
''
|
||||
];
|
||||
|
||||
system.activatableSystemBuilderCommands = ''
|
||||
mkdir $out/bin
|
||||
substitute ${./switch-to-configuration.pl} $out/bin/switch-to-configuration \
|
||||
--subst-var out \
|
||||
--subst-var-by toplevel ''${!toplevelVar} \
|
||||
--subst-var-by coreutils "${pkgs.coreutils}" \
|
||||
--subst-var-by distroId ${lib.escapeShellArg config.system.nixos.distroId} \
|
||||
--subst-var-by installBootLoader ${lib.escapeShellArg config.system.build.installBootLoader} \
|
||||
--subst-var-by preSwitchCheck ${lib.escapeShellArg config.system.preSwitchChecksScript} \
|
||||
--subst-var-by localeArchive "${config.i18n.glibcLocales}/lib/locale/locale-archive" \
|
||||
--subst-var-by perl "${perlWrapped}" \
|
||||
--subst-var-by shell "${pkgs.bash}/bin/sh" \
|
||||
--subst-var-by su "${pkgs.shadow.su}/bin/su" \
|
||||
--subst-var-by systemd "${config.systemd.package}" \
|
||||
--subst-var-by utillinux "${pkgs.util-linux}" \
|
||||
;
|
||||
|
||||
chmod +x $out/bin/switch-to-configuration
|
||||
${lib.optionalString (pkgs.stdenv.hostPlatform == pkgs.stdenv.buildPlatform) ''
|
||||
if ! output=$(${perlWrapped}/bin/perl -c $out/bin/switch-to-configuration 2>&1); then
|
||||
echo "switch-to-configuration syntax is not valid:"
|
||||
echo "$output"
|
||||
exit 1
|
||||
fi
|
||||
''}
|
||||
'';
|
||||
})
|
||||
(lib.mkIf config.system.switch.enableNg {
|
||||
config = lib.mkIf config.system.switch.enable {
|
||||
# Use a subshell so we can source makeWrapper's setup hook without
|
||||
# affecting the rest of activatableSystemBuilderCommands.
|
||||
system.activatableSystemBuilderCommands = ''
|
||||
@@ -99,7 +49,5 @@ in
|
||||
--set SYSTEMD ${config.systemd.package}
|
||||
)
|
||||
'';
|
||||
})
|
||||
];
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1280,14 +1280,7 @@ in
|
||||
swapspace = handleTestOn [ "aarch64-linux" "x86_64-linux" ] ./swapspace.nix { };
|
||||
sway = runTest ./sway.nix;
|
||||
swayfx = runTest ./swayfx.nix;
|
||||
switchTest = runTest {
|
||||
imports = [ ./switch-test.nix ];
|
||||
defaults.system.switch.enableNg = false;
|
||||
};
|
||||
switchTestNg = runTest {
|
||||
imports = [ ./switch-test.nix ];
|
||||
defaults.system.switch.enableNg = true;
|
||||
};
|
||||
switchTest = runTest ./switch-test.nix;
|
||||
sx = runTest ./sx.nix;
|
||||
sympa = runTest ./sympa.nix;
|
||||
syncthing = runTest ./syncthing.nix;
|
||||
|
||||
@@ -663,7 +663,7 @@ in
|
||||
'';
|
||||
|
||||
# Returns a comma separated representation of the given list in sorted
|
||||
# order, that matches the output format of switch-to-configuration.pl
|
||||
# order, that matches the output format of switch-to-configuration
|
||||
sortedUnits = xs: lib.concatStringsSep ", " (builtins.sort builtins.lessThan xs);
|
||||
|
||||
dbusService =
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# switch-to-configuration-ng
|
||||
|
||||
This program is a reimplementation of [switch-to-configuration](/nixos/modules/system/activation/switch-to-configuration.pl) in Rust. The goal is to be compatible in as many ways as possible to the original implementation, at least as long as the original is still in nixpkgs. Any behavioral modifications to this program should also be implemented in the original, and vice versa.
|
||||
This program implements the switching/updating of NixOS systems. It starts with the exising running configuration at `/run/current-system` and handles the migration to a new configuration, built from a NixOS configuration's `config.system.build.toplevel` derivation.
|
||||
|
||||
For more information on what happens during a switch, see [what-happens-during-a-system-switch](../../../../nixos/doc/manual/development/what-happens-during-a-system-switch.chapter.md).
|
||||
|
||||
## Build in a devshell
|
||||
|
||||
|
||||
Reference in New Issue
Block a user