Unverified Commit 5f6dca84 authored by Hans Christian Schmitz's avatar Hans Christian Schmitz
Browse files

nixos/pipewire: add assertions for migration to `extraConfig`/`configPackages`

The PR #282377 made files/directories specified in
`environment.etc."pipewire<...>"` and `environment.etc."wireplumber<...>"`
conflict with existing configuration of the PipeWire NixOS module due to how
the `configPackages` options were implemented. This sadly wasn't easily
avoidable. As this can cause breakage for users moving from 23.11 to 24.05
though, assertions can help guide them to use `services.pipewire.extraConfig`
or `services.pipewire.configPackages` / `services.wireplumber.configPackages`
instead, fixing the breakage.
parent 98684f45
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -293,6 +293,18 @@ in {
        assertion = (cfg.alsa.enable || cfg.pulse.enable) -> cfg.audio.enable;
        message = "Using PipeWire's ALSA/PulseAudio compatibility layers requires running PipeWire as the sound server. Set `services.pipewire.audio.enable` to true.";
      }
      {
        assertion = builtins.length
          (builtins.attrNames
            (
              lib.filterAttrs
                (name: value:
                  lib.hasPrefix "pipewire/" name || name == "pipewire"
                )
                config.environment.etc
            )) == 1;
        message = "Using `environment.etc.\"pipewire<...>\"` directly is no longer supported in 24.05. Use `services.pipewire.extraConfig` or `services.pipewire.configPackages` instead.";
      }
    ];

    environment.systemPackages = [ cfg.package ]
+12 −0
Original line number Diff line number Diff line
@@ -98,6 +98,18 @@ in
          assertion = !config.hardware.bluetooth.hsphfpd.enable;
          message = "Using WirePlumber conflicts with hsphfpd, as it provides the same functionality. `hardware.bluetooth.hsphfpd.enable` needs be set to false";
        }
        {
          assertion = builtins.length
            (builtins.attrNames
              (
                lib.filterAttrs
                  (name: value:
                    lib.hasPrefix "wireplumber/" name || name == "wireplumber"
                  )
                  config.environment.etc
              )) == 1;
          message = "Using `environment.etc.\"wireplumber<...>\"` directly is no longer supported in 24.05. Use `services.wireplumber.configPackages` instead.";
        }
      ];

      environment.systemPackages = [ cfg.package ];