forked from pub-solar/os
audio: enable security.rtkit for pipewire
This should avoid stuttering audio when CPU is busy
This commit is contained in:
parent
d69ed82a31
commit
5ea57eaea6
|
@ -1,11 +1,14 @@
|
||||||
{ lib, config, pkgs, ... }:
|
{
|
||||||
with lib;
|
lib,
|
||||||
let
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
with lib; let
|
||||||
psCfg = config.pub-solar;
|
psCfg = config.pub-solar;
|
||||||
cfg = config.pub-solar.audio;
|
cfg = config.pub-solar.audio;
|
||||||
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
xdg = config.home-manager.users."${psCfg.user.name}".xdg;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.pub-solar.audio = {
|
options.pub-solar.audio = {
|
||||||
enable = mkEnableOption "Life in highs and lows";
|
enable = mkEnableOption "Life in highs and lows";
|
||||||
mopidy.enable = mkEnableOption "Life with mopidy";
|
mopidy.enable = mkEnableOption "Life with mopidy";
|
||||||
|
@ -20,40 +23,49 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
users.users = pkgs.lib.setAttrByPath [ psCfg.user.name ] {
|
users.users = pkgs.lib.setAttrByPath [psCfg.user.name] {
|
||||||
extraGroups = [ "audio" ];
|
extraGroups = ["audio"];
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager = with pkgs; pkgs.lib.setAttrByPath [ "users" psCfg.user.name ] {
|
home-manager = with pkgs;
|
||||||
home.packages = [
|
pkgs.lib.setAttrByPath ["users" psCfg.user.name] {
|
||||||
# easyeffects, e.g. for microphone noise filtering
|
home.packages =
|
||||||
easyeffects
|
[
|
||||||
mu
|
# easyeffects, e.g. for microphone noise filtering
|
||||||
pavucontrol
|
easyeffects
|
||||||
pa_applet
|
mu
|
||||||
playerctl
|
pavucontrol
|
||||||
# Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?)
|
pa_applet
|
||||||
pulseaudio
|
playerctl
|
||||||
vimpc
|
# Needed for pactl cmd, until pw-cli is more mature (vol up/down hotkeys?)
|
||||||
] ++ (if cfg.spotify.enable then [ pkgs.spotify-tui ] else [ ]);
|
pulseaudio
|
||||||
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
|
vimpc
|
||||||
systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs;
|
]
|
||||||
|
++ (
|
||||||
|
if cfg.spotify.enable
|
||||||
|
then [pkgs.spotify-tui]
|
||||||
|
else []
|
||||||
|
);
|
||||||
|
xdg.configFile."vimpc/vimpcrc".source = ./.config/vimpc/vimpcrc;
|
||||||
|
systemd.user.services.easyeffects = import ./easyeffects.service.nix pkgs;
|
||||||
|
|
||||||
services.spotifyd = mkIf cfg.spotify.enable {
|
services.spotifyd = mkIf cfg.spotify.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
global = {
|
global = {
|
||||||
username = cfg.spotify.username;
|
username = cfg.spotify.username;
|
||||||
password_cmd = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus ${pkgs.libsecret}/bin/secret-tool lookup spotify password";
|
password_cmd = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus ${pkgs.libsecret}/bin/secret-tool lookup spotify password";
|
||||||
bitrate = 320;
|
bitrate = 320;
|
||||||
volume_normalisation = true;
|
volume_normalisation = true;
|
||||||
no_audio_cache = false;
|
no_audio_cache = false;
|
||||||
max_cache_size = 1000000000;
|
max_cache_size = 1000000000;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
# rtkit is optional but recommended
|
||||||
|
security.rtkit.enable = true;
|
||||||
# Enable sound using pipewire-pulse
|
# Enable sound using pipewire-pulse
|
||||||
services.pipewire = {
|
services.pipewire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -63,7 +75,7 @@ in
|
||||||
|
|
||||||
config.pipewire = {
|
config.pipewire = {
|
||||||
context.default.clock = {
|
context.default.clock = {
|
||||||
allowed-rates = [ 44100 48000 88200 96000 ];
|
allowed-rates = [44100 48000 88200 96000];
|
||||||
rate = 44100;
|
rate = 44100;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue