about summary refs log tree commit diff
path: root/nixos/modules/services/desktops
diff options
context:
space:
mode:
authorHans Christian Schmitz <git@hcsch.eu>2024-02-27 16:27:20 +0100
committerHans Christian Schmitz <git@hcsch.eu>2024-02-28 01:22:28 +0100
commit5f6dca8403b9af3e53e51a92393f9993aaa8fc0b (patch)
tree9c8ee93b2edd52ac02f4a5d854f33fd66982d1a2 /nixos/modules/services/desktops
parent98684f4504e98c11b69cae8b9e1a7031e4989a3d (diff)
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.
Diffstat (limited to 'nixos/modules/services/desktops')
-rw-r--r--nixos/modules/services/desktops/pipewire/pipewire.nix12
-rw-r--r--nixos/modules/services/desktops/pipewire/wireplumber.nix12
2 files changed, 24 insertions, 0 deletions
diff --git a/nixos/modules/services/desktops/pipewire/pipewire.nix b/nixos/modules/services/desktops/pipewire/pipewire.nix
index aa24c0842baba..8f3ad78d50ce1 100644
--- a/nixos/modules/services/desktops/pipewire/pipewire.nix
+++ b/nixos/modules/services/desktops/pipewire/pipewire.nix
@@ -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 ]
diff --git a/nixos/modules/services/desktops/pipewire/wireplumber.nix b/nixos/modules/services/desktops/pipewire/wireplumber.nix
index dc4d726d76327..0d3545ae7b4b3 100644
--- a/nixos/modules/services/desktops/pipewire/wireplumber.nix
+++ b/nixos/modules/services/desktops/pipewire/wireplumber.nix
@@ -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 ];