mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-21 20:49:52 +03:00
nixos/pipewire: cleanup module
This commit is contained in:
parent
798b9c072e
commit
f6745d06f5
@ -9,6 +9,10 @@ let
|
|||||||
&& pkgs.stdenv.isx86_64
|
&& pkgs.stdenv.isx86_64
|
||||||
&& pkgs.pkgsi686Linux.pipewire != null;
|
&& pkgs.pkgsi686Linux.pipewire != null;
|
||||||
|
|
||||||
|
# The package doesn't output to $out/lib/pipewire directly so that the
|
||||||
|
# overlays can use the outputs to replace the originals in FHS environments.
|
||||||
|
#
|
||||||
|
# This doesn't work in general because of missing development information.
|
||||||
jack-libs = pkgs.runCommand "jack-libs" {} ''
|
jack-libs = pkgs.runCommand "jack-libs" {} ''
|
||||||
mkdir -p "$out/lib"
|
mkdir -p "$out/lib"
|
||||||
ln -s "${pkgs.pipewire.jack}/lib" "$out/lib/pipewire"
|
ln -s "${pkgs.pipewire.jack}/lib" "$out/lib/pipewire"
|
||||||
@ -37,41 +41,16 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
alsa = {
|
alsa = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "ALSA support";
|
||||||
default = false;
|
support32Bit = mkEnableOption "32-bit ALSA support on 64-bit systems";
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Route audio to/from generic ALSA-using applications via the ALSA PIPEWIRE PCM plugin.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
support32Bit = mkOption {
|
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Whether to support sound for 32-bit ALSA applications on a 64-bit system.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jack = {
|
jack = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "JACK audio emulation";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Enable transparent JACK audio emulation using LD_LIBRARY_PATH.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pulse = {
|
pulse = {
|
||||||
enable = mkOption {
|
enable = mkEnableOption "PulseAudio emulation";
|
||||||
default = false;
|
|
||||||
type = types.bool;
|
|
||||||
description = ''
|
|
||||||
Enable transparent PulseAudio emulation using LD_LIBRARY_PATH.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -79,12 +58,25 @@ in {
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.pulse.enable -> !config.hardware.pulseaudio.enable;
|
||||||
|
message = "PipeWire based PulseAudio emulation doesn't use the PulseAudio service";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
assertion = cfg.jack.enable -> !config.services.jack.jackd.enable;
|
||||||
|
message = "PIpeWire based JACK emulation doesn't use the JACK service";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.pipewire ]
|
environment.systemPackages = [ pkgs.pipewire ]
|
||||||
++ lib.optional cfg.jack.enable jack-libs
|
++ lib.optional cfg.jack.enable jack-libs
|
||||||
++ lib.optional cfg.pulse.enable pulse-libs;
|
++ lib.optional cfg.pulse.enable pulse-libs;
|
||||||
|
|
||||||
systemd.packages = [ pkgs.pipewire ];
|
systemd.packages = [ pkgs.pipewire ];
|
||||||
|
|
||||||
|
# PipeWire depends on DBUS but doesn't list it. Without this booting
|
||||||
|
# into a terminal results in the service crashing with an error.
|
||||||
systemd.user.sockets.pipewire.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
|
systemd.user.sockets.pipewire.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
|
||||||
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
systemd.user.services.pipewire.bindsTo = [ "dbus.service" ];
|
||||||
services.udev.packages = [ pkgs.pipewire ];
|
services.udev.packages = [ pkgs.pipewire ];
|
||||||
@ -107,6 +99,7 @@ in {
|
|||||||
environment.etc."alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
|
environment.etc."alsa/conf.d/50-pipewire.conf" = mkIf cfg.alsa.enable {
|
||||||
source = "${pkgs.pipewire}/share/alsa/alsa.conf.d/50-pipewire.conf";
|
source = "${pkgs.pipewire}/share/alsa/alsa.conf.d/50-pipewire.conf";
|
||||||
};
|
};
|
||||||
environment.sessionVariables.LD_LIBRARY_PATH = [ "/run/current-system/sw/lib/pipewire" ];
|
environment.sessionVariables.LD_LIBRARY_PATH =
|
||||||
|
lib.optional (cfg.alsa.enable || cfg.jack.enable || cfg.pulse.enable) "/run/current-system/sw/lib/pipewire";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user