nixos: switch to switch-to-configuration-ng by default (#339727)

This commit is contained in:
Emily 2024-09-06 09:30:27 +01:00 committed by GitHub
commit fe63e7a0aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 38 deletions

View File

@ -1,11 +1,5 @@
# Perlless {#sec-perlless}
::: {.warning}
If you enable this profile, you will NOT be able to switch to a new
configuration and thus you will not be able to rebuild your system with
nixos-rebuild!
:::
Render your system completely perlless (i.e. without the perl interpreter). This
includes a mechanism so that your build fails if it contains a Nix store path
that references the string "perl".

View File

@ -34,6 +34,10 @@
Users that want to keep PulseAudio will want to set `services.pipewire.enable = false;` and `hardware.pulseaudio.enable = true;`.
There is currently no plan to fully deprecate and remove PulseAudio, however, PipeWire should generally be preferred for new installs.
- The Rust rewrite of the `switch-to-configuration` program is now used for system activation by default.
If you experience any issues, please report them.
The original Perl script can still be used for now by setting `system.switch.enableNg` to `false`.
## New Modules {#sec-release-24.11-new-modules}
- [TaskChampion Sync-Server](https://github.com/GothenburgBitFactory/taskchampion-sync-server), a [Taskwariror 3](https://taskwarrior.org/docs/upgrade-3/) sync server, replacing Taskwarrior 2's sync server named [`taskserver`](https://github.com/GothenburgBitFactory/taskserver).

View File

@ -2,13 +2,6 @@
{
# switch-to-configuration-ng reimplements switch-to-configuration, but
# without perl.
system.switch = lib.mkDefault {
enable = false;
enableNg = true;
};
# Remove perl from activation
boot.initrd.systemd.enable = lib.mkDefault true;
system.etc.overlay.enable = lib.mkDefault true;

View File

@ -4,14 +4,6 @@ let
perlWrapped = pkgs.perl.withPackages (p: with p; [ ConfigIniFiles FileSlurp ]);
description = extra: ''
Whether to include the capability to switch configurations.
Disabling this makes the system unable to be reconfigured via `nixos-rebuild`.
${extra}
'';
in
{
@ -20,7 +12,11 @@ in
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = description ''
description = ''
Whether to include the capability to switch configurations.
Disabling this makes the system unable to be reconfigured via `nixos-rebuild`.
This is good for image based appliances where updates are handled
outside the image. Reducing features makes the image lighter and
slightly more secure.
@ -29,23 +25,17 @@ in
enableNg = lib.mkOption {
type = lib.types.bool;
default = false;
description = description ''
Whether to use `switch-to-configuration-ng`, an experimental
re-implementation of `switch-to-configuration` with the goal of
replacing the original.
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 [
{
assertions = [{
assertion = with config.system.switch; enable -> !enableNg;
message = "Only one of system.switch.enable and system.switch.enableNg may be enabled at a time";
}];
}
(lib.mkIf config.system.switch.enable {
(lib.mkIf (config.system.switch.enable && !config.system.switch.enableNg) {
system.activatableSystemBuilderCommands = ''
mkdir $out/bin
substitute ${./switch-to-configuration.pl} $out/bin/switch-to-configuration \

View File

@ -48,10 +48,7 @@ in {
nodes = {
machine = { pkgs, lib, ... }: {
system.switch = {
enable = !ng;
enableNg = ng;
};
system.switch.enableNg = ng;
environment.systemPackages = [ pkgs.socat ]; # for the socket activation stuff
users.mutableUsers = false;