nixos: hardware.pulseaudio → services.pulseaudio (#369391)

This commit is contained in:
nicoo 2024-12-30 13:46:50 +00:00 committed by GitHub
parent 47fb7ae5f0
commit 238b407862
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 33 additions and 28 deletions

View file

@ -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''`. - `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. - `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. - `racket_7_9` has been removed, as it is insecure. It is recommended to use Racket 8 instead.

View file

@ -96,7 +96,7 @@ let
# services.printing.enable = true; # services.printing.enable = true;
# Enable sound. # Enable sound.
# hardware.pulseaudio.enable = true; # services.pulseaudio.enable = true;
# OR # OR
# services.pipewire = { # services.pipewire = {
# enable = true; # enable = true;

View file

@ -22,7 +22,6 @@
./config/nix-remote-build.nix ./config/nix-remote-build.nix
./config/nsswitch.nix ./config/nsswitch.nix
./config/power-management.nix ./config/power-management.nix
./config/pulseaudio.nix
./config/qt.nix ./config/qt.nix
./config/resolvconf.nix ./config/resolvconf.nix
./config/shells-environment.nix ./config/shells-environment.nix
@ -407,6 +406,7 @@
./services/audio/mympd.nix ./services/audio/mympd.nix
./services/audio/navidrome.nix ./services/audio/navidrome.nix
./services/audio/networkaudiod.nix ./services/audio/networkaudiod.nix
./services/audio/pulseaudio.nix
./services/audio/roon-bridge.nix ./services/audio/roon-bridge.nix
./services/audio/roon-server.nix ./services/audio/roon-server.nix
./services/audio/slimserver.nix ./services/audio/slimserver.nix

View file

@ -197,7 +197,7 @@ in {
services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ]; services.displayManager.sessionPackages = lib.mkIf cfg.gamescopeSession.enable [ gamescopeSessionFile ];
# enable 32bit pulseaudio/pipewire support if needed # 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; services.pipewire.alsa.support32Bit = config.services.pipewire.alsa.enable;
hardware.steam-hardware.enable = true; hardware.steam-hardware.enable = true;

View file

@ -258,7 +258,7 @@ in
{ {
User = "jackaudio"; User = "jackaudio";
SupplementaryGroups = lib.optional ( SupplementaryGroups = lib.optional (
config.hardware.pulseaudio.enable && !config.hardware.pulseaudio.systemWide config.services.pulseaudio.enable && !config.services.pulseaudio.systemWide
) "users"; ) "users";
ExecStart = "${cfg.jackd.package}/bin/jackd ${lib.escapeShellArgs cfg.jackd.extraOptions}"; ExecStart = "${cfg.jackd.package}/bin/jackd ${lib.escapeShellArgs cfg.jackd.extraOptions}";
LimitRTPRIO = 99; LimitRTPRIO = 99;

View file

@ -6,7 +6,7 @@
}: }:
let let
cfg = config.hardware.pulseaudio; cfg = config.services.pulseaudio;
hasZeroconf = hasZeroconf =
let let
@ -90,10 +90,13 @@ let
in in
{ {
imports = [
(lib.mkRenamedOptionModule [ "hardware" "pulseaudio" ] [ "services" "pulseaudio" ])
];
options = { options = {
hardware.pulseaudio = { services.pulseaudio = {
enable = lib.mkOption { enable = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = false; default = false;
@ -239,13 +242,13 @@ in
"libao.conf".source = pkgs.writeText "libao.conf" "default_driver=pulse"; "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 # 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 # 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. # Allow PulseAudio to get realtime priority using rtkit.
security.rtkit.enable = true; security.rtkit.enable = true;
@ -257,7 +260,7 @@ in
} }
(lib.mkIf (cfg.extraModules != [ ]) { (lib.mkIf (cfg.extraModules != [ ]) {
hardware.pulseaudio.daemon.config.dl-search-path = services.pulseaudio.daemon.config.dl-search-path =
let let
overriddenModules = builtins.map ( overriddenModules = builtins.map (
drv: drv.override { pulseaudio = overriddenPackage; } drv: drv.override { pulseaudio = overriddenPackage; }

View file

@ -146,7 +146,7 @@ in
ayatana-indicator-power ayatana-indicator-power
] ]
++ lib.optionals config.hardware.bluetooth.enable [ ayatana-indicator-bluetooth ] ++ 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 ayatana-indicator-sound
] ]
) )

View file

@ -207,7 +207,7 @@ in
pkgs.obexftp pkgs.obexftp
] ]
++ lib.optional config.networking.networkmanager.enable plasma-nm ++ 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.services.pipewire.pulse.enable plasma-pa
++ lib.optional config.powerManagement.enable powerdevil ++ lib.optional config.powerManagement.enable powerdevil
++ lib.optional config.services.printing.enable print-manager ++ lib.optional config.services.printing.enable print-manager

View file

@ -347,8 +347,8 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = [ assertions = [
{ {
assertion = cfg.audio.enable -> !config.hardware.pulseaudio.enable; assertion = cfg.audio.enable -> !config.services.pulseaudio.enable;
message = "Using PipeWire as the sound server conflicts with PulseAudio. This option requires `hardware.pulseaudio.enable` to be set to false"; 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; assertion = cfg.jack.enable -> !config.services.jack.jackd.enable;

View file

@ -84,7 +84,7 @@ in
createHome = true; createHome = true;
home = "/var/lib/shairport-sync"; home = "/var/lib/shairport-sync";
group = cfg.group; 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} = {}; groups.${cfg.group} = {};
}; };

View file

@ -135,7 +135,7 @@ in
(mkIf cfg.audio.enable { (mkIf cfg.audio.enable {
environment.systemPackages = [ cfg.audio.package ]; # needed for autostart environment.systemPackages = [ cfg.audio.package ]; # needed for autostart
hardware.pulseaudio.extraModules = [ cfg.audio.package ]; services.pulseaudio.extraModules = [ cfg.audio.package ];
}) })
(mkIf cfg.enable { (mkIf cfg.enable {

View file

@ -292,7 +292,7 @@ in
# Optional hardware support features # Optional hardware support features
++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt pkgs.openobex pkgs.obexftp ] ++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt pkgs.openobex pkgs.obexftp ]
++ lib.optional config.networking.networkmanager.enable plasma-nm ++ 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.services.pipewire.pulse.enable plasma-pa
++ lib.optional config.powerManagement.enable powerdevil ++ lib.optional config.powerManagement.enable powerdevil
++ lib.optional config.services.colord.enable pkgs.colord-kde ++ lib.optional config.services.colord.enable pkgs.colord-kde
@ -477,7 +477,7 @@ in
} }
{ {
# The user interface breaks without pulse # 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."; message = "Plasma Mobile requires a Pulseaudio compatible sound server.";
} }
]; ];

View file

@ -132,7 +132,7 @@ in
] # TODO: NetworkManager doesn't belong here ] # TODO: NetworkManager doesn't belong here
++ optional config.networking.networkmanager.enable networkmanagerapplet ++ optional config.networking.networkmanager.enable networkmanagerapplet
++ optional config.powerManagement.enable xfce.xfce4-power-manager ++ 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 pavucontrol
# volume up/down keys support: # volume up/down keys support:
# xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse # xfce4-pulseaudio-plugin includes all the functionalities of xfce4-volumed-pulse

View file

@ -196,7 +196,7 @@ in
[ [
"d /run/gdm/.config 0711 gdm gdm" "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" "d /run/gdm/.config/pulse 0711 gdm gdm"
"L+ /run/gdm/.config/pulse/${pulseConfig.name} - - - - ${pulseConfig}" "L+ /run/gdm/.config/pulse/${pulseConfig.name} - - - - ${pulseConfig}"
] ]

View file

@ -251,8 +251,8 @@ in
environment.systemPackages = [pkgs.xpra]; environment.systemPackages = [pkgs.xpra];
hardware.pulseaudio.enable = mkDefault cfg.pulseaudio; services.pulseaudio.enable = mkDefault cfg.pulseaudio;
hardware.pulseaudio.systemWide = mkDefault cfg.pulseaudio; services.pulseaudio.systemWide = mkDefault cfg.pulseaudio;
}; };
} }

View file

@ -99,7 +99,7 @@ import ./make-test-python.nix (
musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; }; musicService = musicService { inherit (defaultMpdCfg) user group musicDirectory; };
}) })
{ {
hardware.pulseaudio = { services.pulseaudio = {
enable = true; enable = true;
systemWide = true; systemWide = true;
tcp.enable = true; tcp.enable = true;

View file

@ -38,7 +38,7 @@ let
{ {
imports = [ ./common/wayland-cage.nix ]; imports = [ ./common/wayland-cage.nix ];
hardware.pulseaudio = services.pulseaudio =
{ {
enable = true; enable = true;
support32Bit = true; support32Bit = true;

View file

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

View file

@ -6,8 +6,8 @@
{ {
environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ]; environment.systemPackages = [ (pkgs.python3.withPackages (ps: [ ps.soundcard ])) ];
hardware.pulseaudio.enable = true; services.pulseaudio.enable = true;
hardware.pulseaudio.systemWide = true; services.pulseaudio.systemWide = true;
virtualisation.qemu.options = [ virtualisation.qemu.options = [
"-device virtio-sound-pci,audiodev=my_audiodev" "-device virtio-sound-pci,audiodev=my_audiodev"