Skip to content

Commit

Permalink
nixos: hardware.pulseaudio → services.pulseaudio (#369391)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbraud authored Dec 30, 2024
1 parent 47fb7ae commit 238b407
Show file tree
Hide file tree
Showing 19 changed files with 33 additions and 28 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2505.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@

- `programs.less.lessopen` is now null by default. To restore the previous behaviour, set it to `''|${lib.getExe' pkgs.lesspipe "lesspipe.sh"} %s''`.

- `hardware.pulseaudio` has been renamed to `services.pulseaudio`. The deprecated option names will continue to work, but causes a warning.

- `minetest` has been renamed to `luanti` to match the upstream name change but aliases have been added. The new name hasn't resulted in many changes as of yet but older references to minetest should be sunset. See the [new name announcement](https://blog.minetest.net/2024/10/13/Introducing-Our-New-Name/) for more details.

- `racket_7_9` has been removed, as it is insecure. It is recommended to use Racket 8 instead.
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/installer/tools/tools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ let
# services.printing.enable = true;
# Enable sound.
# hardware.pulseaudio.enable = true;
# services.pulseaudio.enable = true;
# OR
# services.pipewire = {
# enable = true;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
./config/nix-remote-build.nix
./config/nsswitch.nix
./config/power-management.nix
./config/pulseaudio.nix
./config/qt.nix
./config/resolvconf.nix
./config/shells-environment.nix
Expand Down Expand Up @@ -407,6 +406,7 @@
./services/audio/mympd.nix
./services/audio/navidrome.nix
./services/audio/networkaudiod.nix
./services/audio/pulseaudio.nix
./services/audio/roon-bridge.nix
./services/audio/roon-server.nix
./services/audio/slimserver.nix
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/programs/steam.nix
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ in {
services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ];

# enable 32bit pulseaudio/pipewire support if needed
hardware.pulseaudio.support32Bit = config.hardware.pulseaudio.enable;
services.pulseaudio.support32Bit = config.services.pulseaudio.enable;
services.pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable;

hardware.steam-hardware.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/audio/jack.nix
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ in
{
User = "jackaudio";
SupplementaryGroups = lib.optional (
config.hardware.pulseaudio.enable && !config.hardware.pulseaudio.systemWide
config.services.pulseaudio.enable && !config.services.pulseaudio.systemWide
) "users";
ExecStart = "${cfg.jackd.package}/bin/jackd ${lib.escapeShellArgs cfg.jackd.extraOptions}";
LimitRTPRIO = 99;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}:
let

cfg = config.hardware.pulseaudio;
cfg = config.services.pulseaudio;

hasZeroconf =
let
Expand Down Expand Up @@ -90,10 +90,13 @@ let

in
{
imports = [
(lib.mkRenamedOptionModule [ "hardware" "pulseaudio" ] [ "services" "pulseaudio" ])
];

options = {

hardware.pulseaudio = {
services.pulseaudio = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
Expand Down Expand Up @@ -239,13 +242,13 @@ in
"libao.conf".source = pkgs.writeText "libao.conf" "default_driver=pulse";
};

hardware.pulseaudio.configFile = lib.mkDefault "${lib.getBin overriddenPackage}/etc/pulse/default.pa";
services.pulseaudio.configFile = lib.mkDefault "${lib.getBin overriddenPackage}/etc/pulse/default.pa";

# Disable flat volumes to enable relative ones
hardware.pulseaudio.daemon.config.flat-volumes = lib.mkDefault "no";
services.pulseaudio.daemon.config.flat-volumes = lib.mkDefault "no";

# Upstream defaults to speex-float-1 which results in audible artifacts
hardware.pulseaudio.daemon.config.resample-method = lib.mkDefault "speex-float-5";
services.pulseaudio.daemon.config.resample-method = lib.mkDefault "speex-float-5";

# Allow PulseAudio to get realtime priority using rtkit.
security.rtkit.enable = true;
Expand All @@ -257,7 +260,7 @@ in
}

(lib.mkIf (cfg.extraModules != [ ]) {
hardware.pulseaudio.daemon.config.dl-search-path =
services.pulseaudio.daemon.config.dl-search-path =
let
overriddenModules = builtins.map (
drv: drv.override { pulseaudio = overriddenPackage; }
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/desktop-managers/lomiri.nix
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ in
ayatana-indicator-power
]
++ lib.optionals config.hardware.bluetooth.enable [ ayatana-indicator-bluetooth ]
++ lib.optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [
++ lib.optionals (config.services.pulseaudio.enable || config.services.pipewire.pulse.enable) [
ayatana-indicator-sound
]
)
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/desktop-managers/plasma6.nix
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ in
pkgs.obexftp
]
++ lib.optional config.networking.networkmanager.enable plasma-nm
++ lib.optional config.hardware.pulseaudio.enable plasma-pa
++ lib.optional config.services.pulseaudio.enable plasma-pa
++ lib.optional config.services.pipewire.pulse.enable plasma-pa
++ lib.optional config.powerManagement.enable powerdevil
++ lib.optional config.services.printing.enable print-manager
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/desktops/pipewire/pipewire.nix
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,8 @@ in
config = mkIf cfg.enable {
assertions = [
{
assertion = cfg.audio.enable -> !config.hardware.pulseaudio.enable;
message = "Using PipeWire as the sound server conflicts with PulseAudio. This option requires `hardware.pulseaudio.enable` to be set to false";
assertion = cfg.audio.enable -> !config.services.pulseaudio.enable;
message = "Using PipeWire as the sound server conflicts with PulseAudio. This option requires `services.pulseaudio.enable` to be set to false";
}
{
assertion = cfg.jack.enable -> !config.services.jack.jackd.enable;
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/shairport-sync.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ in
createHome = true;
home = "/var/lib/shairport-sync";
group = cfg.group;
extraGroups = [ "audio" ] ++ optional (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) "pulse";
extraGroups = [ "audio" ] ++ optional (config.services.pulseaudio.enable || config.services.pipewire.pulse.enable) "pulse";
};
groups.${cfg.group} = {};
};
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/xrdp.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ in
(mkIf cfg.audio.enable {
environment.systemPackages = [ cfg.audio.package ]; # needed for autostart

hardware.pulseaudio.extraModules = [ cfg.audio.package ];
services.pulseaudio.extraModules = [ cfg.audio.package ];
})

(mkIf cfg.enable {
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/x11/desktop-managers/plasma5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ in
# Optional hardware support features
++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt pkgs.openobex pkgs.obexftp ]
++ lib.optional config.networking.networkmanager.enable plasma-nm
++ lib.optional config.hardware.pulseaudio.enable plasma-pa
++ lib.optional config.services.pulseaudio.enable plasma-pa
++ lib.optional config.services.pipewire.pulse.enable plasma-pa
++ lib.optional config.powerManagement.enable powerdevil
++ lib.optional config.services.colord.enable pkgs.colord-kde
Expand Down Expand Up @@ -477,7 +477,7 @@ in
}
{
# The user interface breaks without pulse
assertion = config.hardware.pulseaudio.enable || (config.services.pipewire.enable && config.services.pipewire.pulse.enable);
assertion = config.services.pulseaudio.enable || (config.services.pipewire.enable && config.services.pipewire.pulse.enable);
message = "Plasma Mobile requires a Pulseaudio compatible sound server.";
}
];
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/xfce.nix
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ in
] # TODO: NetworkManager doesn't belong here
++ optional config.networking.networkmanager.enable networkmanagerapplet
++ optional config.powerManagement.enable xfce.xfce4-power-manager
++ optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [
++ optionals (config.services.pulseaudio.enable || config.services.pipewire.pulse.enable) [
pavucontrol
# volume up/down keys support:
# xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/display-managers/gdm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ in
[
"d /run/gdm/.config 0711 gdm gdm"
]
++ lib.optionals config.hardware.pulseaudio.enable [
++ lib.optionals config.services.pulseaudio.enable [
"d /run/gdm/.config/pulse 0711 gdm gdm"
"L+ /run/gdm/.config/pulse/${pulseConfig.name} - - - - ${pulseConfig}"
]
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/x11/display-managers/xpra.nix
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ in

environment.systemPackages = [pkgs.xpra];

hardware.pulseaudio.enable = mkDefault cfg.pulseaudio;
hardware.pulseaudio.systemWide = mkDefault cfg.pulseaudio;
services.pulseaudio.enable = mkDefault cfg.pulseaudio;
services.pulseaudio.systemWide = mkDefault cfg.pulseaudio;
};

}
2 changes: 1 addition & 1 deletion nixos/tests/mpd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ import ./make-test-python.nix (
musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; };
})
{
hardware.pulseaudio = {
services.pulseaudio = {
enable = true;
systemWide = true;
tcp.enable = true;
Expand Down
2 changes: 1 addition & 1 deletion nixos/tests/pulseaudio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let

{
imports = [ ./common/wayland-cage.nix ];
hardware.pulseaudio =
services.pulseaudio =
{
enable = true;
support32Bit = true;
Expand Down
4 changes: 2 additions & 2 deletions nixos/tests/xrdp-with-audio-pulseaudio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import ./make-test-python.nix (
services.xrdp.audio.enable = true;
services.xrdp.defaultWindowManager = "${pkgs.xterm}/bin/xterm";

hardware.pulseaudio = {
services.pulseaudio = {
enable = true;
};

Expand Down Expand Up @@ -65,7 +65,7 @@ import ./make-test-python.nix (
services.xrdp.audio.enable = true;
services.xrdp.defaultWindowManager = "${pkgs.icewm}/bin/icewm";

hardware.pulseaudio = {
services.pulseaudio = {
enable = true;
};
};
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/soundcard/test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
{
environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ];

hardware.pulseaudio.enable = true;
hardware.pulseaudio.systemWide = true;
services.pulseaudio.enable = true;
services.pulseaudio.systemWide = true;

virtualisation.qemu.options = [
"-device virtio-sound-pci,audiodev=my_audiodev"
Expand Down

0 comments on commit 238b407

Please sign in to comment.