-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsound.nix
50 lines (47 loc) · 1.87 KB
/
sound.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ config, pkgs, ... }:
{
environment.systemPackages = [ pkgs.alsa-utils ];
users.users.akegalj.packages = [ pkgs.pavucontrol ];
# Bellow is pulseaudio/alsa config from 24.05
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/audio/alsa.nix#L89
# Pipewire also works fine but I have managed to have better sound quality with less config
# using pulseaudio
hardware.pulseaudio.enable = true;
# ALSA provides a udev rule for restoring volume settings.
services.udev.packages = [ pkgs.alsa-utils ];
systemd.services.alsa-store =
{ description = "Store Sound Card State";
wantedBy = [ "multi-user.target" ];
unitConfig.RequiresMountsFor = "/var/lib/alsa";
unitConfig.ConditionVirtualization = "!systemd-nspawn";
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecStart = "${pkgs.coreutils}/bin/mkdir -p /var/lib/alsa";
ExecStop = "${pkgs.alsa-utils}/sbin/alsactl store --ignore";
};
};
# We need bluetooth headset only on system76 meerkat
# TODO: conditionally enable there only?
hardware.bluetooth.enable = true; # enables support for Bluetooth
# Pair with https://nixos.wiki/wiki/Bluetooth
# Use `bluetoothctl power on` to connect
# Use `bluetoothctl power off` to disconnect` to connect
hardware.bluetooth.powerOnBoot = false; # powers up the default Bluetooth controller on boot
services.blueman.enable = true;
services.pipewire.enable = false;
# If you want to switch to pupewire instead of pulseaudio uncumment bellow
# services.pipewire.wireplumber.extraConfig."10-bluez" = {
# "monitor.bluez.properties" = {
# "bluez5.enable-sbc-xq" = true;
# "bluez5.enable-msbc" = true;
# "bluez5.enable-hw-volume" = true;
# "bluez5.roles" = [
# "hsp_hs"
# "hsp_ag"
# "hfp_hf"
# "hfp_ag"
# ];
# };
# };
}