50 lines
1.8 KiB
Nix
50 lines
1.8 KiB
Nix
# administer with pw-cli, pw-mon, pw-top commands
|
|
{ config, lib, ... }:
|
|
let
|
|
cfg = config.sane.programs.pipewire;
|
|
in
|
|
{
|
|
sane.programs.pipewire = {
|
|
persist.byStore.plaintext = [
|
|
# persist per-device volume levels
|
|
".local/state/wireplumber"
|
|
];
|
|
};
|
|
|
|
services.pipewire = lib.mkIf cfg.enabled {
|
|
enable = true;
|
|
package = cfg.package;
|
|
alsa.enable = true;
|
|
alsa.support32Bit = true; # ??
|
|
# emulate pulseaudio for legacy apps (e.g. sxmo-utils)
|
|
pulse.enable = true;
|
|
# TODO: try:
|
|
# socketActivation = false;
|
|
};
|
|
systemd.user.services."pipewire".wantedBy = lib.optionals cfg.enabled [ "graphical-session.target" ];
|
|
|
|
# rtkit/RealtimeKit: allow applications which want realtime audio (e.g. Dino? Pulseaudio server?) to request it.
|
|
# this might require more configuration (e.g. polkit-related) to work exactly as desired.
|
|
# - readme outlines requirements: <https://github.com/heftig/rtkit>
|
|
# XXX(2023/10/12): rtkit does not play well on moby. any application sending audio out dies after 10s.
|
|
# security.rtkit.enable = lib.mkIf cfg.enabled true;
|
|
|
|
|
|
# OLD ALSA STUFF:
|
|
# persist per-device volume settings across power cycles.
|
|
# pipewire sits atop the kernel ALSA API, so alsa-utils knows about device volumes.
|
|
# but wireplumber also tries to do some of this
|
|
# systemd.services.alsa-store = {
|
|
# # based on <repo:nixos/nixpkgs:nixos/modules/services/audio/alsa.nix>
|
|
# description = "Store Sound Card State";
|
|
# wantedBy = [ "multi-user.target" ];
|
|
# serviceConfig = {
|
|
# Type = "oneshot";
|
|
# RemainAfterExit = true;
|
|
# ExecStart = "${pkgs.alsa-utils}/sbin/alsactl restore";
|
|
# ExecStop = "${pkgs.alsa-utils}/sbin/alsactl store --ignore";
|
|
# };
|
|
# };
|
|
# sane.persist.sys.byStore.plaintext = [ "/var/lib/alsa" ];
|
|
}
|