Unverified Commit fe63e7a0 authored by Emily's avatar Emily Committed by GitHub
Browse files

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

parents 1318c66d a5cfd68c
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
# 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".
+4 −0
Original line number Diff line number Diff line
@@ -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).
+0 −7
Original line number Diff line number Diff line
@@ -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;
+11 −21
Original line number Diff line number Diff line
@@ -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 \
+1 −4
Original line number Diff line number Diff line
@@ -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;