1
0
forked from c3d2/nix-config

Move audio specific settings from pulsebert to audioserver

This commit is contained in:
Sandro - 2023-04-29 23:05:39 +02:00
parent 9b70709d50
commit a23f73e88b
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 76 additions and 64 deletions

View File

@ -66,12 +66,9 @@
domain = "hq.c3d2.de"; domain = "hq.c3d2.de";
firewall = { firewall = {
allowedTCPPorts = [ allowedTCPPorts = [
80 # ledfx
4713 # pulseaudio/pipewire network sync
5355 # llmnr 5355 # llmnr
]; ];
allowedUDPPorts = [ allowedUDPPorts = [
5353 # mdns
5355 # llmnr 5355 # llmnr
]; ];
}; };
@ -80,14 +77,6 @@
interfaces.eth0.useDHCP = true; interfaces.eth0.useDHCP = true;
}; };
environment.systemPackages = with pkgs; [
mpd
mpv
ncmpcpp
ncpamixer
pulseaudio # required for pactl
];
# https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16 # https://github.com/dump-dvb/nix-config/blob/310ceedca5ab2d5c22070bd73c603926b6100a74/hardware/configuration-rpi-3b.nix#L16
sdImage = lib.mkForce { sdImage = lib.mkForce {
populateFirmwareCommands = populateFirmwareCommands =
@ -144,25 +133,17 @@
''; '';
}; };
security = { security.sudo = {
rtkit.enable = true;
sudo = {
enable = true; enable = true;
wheelNeedsPassword = false; wheelNeedsPassword = false;
}; };
};
services = { services = {
avahi.nssmdns = true;
# Do not log to flash but also breaks journalctl --user # Do not log to flash but also breaks journalctl --user
# journald.extraConfig = '' # journald.extraConfig = ''
# Storage=volatile # Storage=volatile
# ''; # '';
openssh = {
enable = true;
};
nginx = { nginx = {
enable = true; enable = true;
virtualHosts = { virtualHosts = {

View File

@ -6,8 +6,16 @@
}; };
config = lib.mkIf config.c3d2.audioServer.enable { config = lib.mkIf config.c3d2.audioServer.enable {
sound.enable = true; environment.systemPackages = with pkgs; [
hardware.bluetooth = { mpd
mpv
ncmpcpp
ncpamixer
pulseaudio # required for pactl
];
hardware = {
bluetooth = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
settings = { settings = {
Policy.AutoEnable = true; Policy.AutoEnable = true;
@ -15,7 +23,7 @@
}; };
}; };
hardware.pulseaudio = { pulseaudio = {
enable = !config.services.pipewire.pulse.enable; enable = !config.services.pipewire.pulse.enable;
systemWide = true; systemWide = true;
tcp = { tcp = {
@ -40,6 +48,19 @@
doCheck = false; doCheck = false;
}); });
}; };
};
networking.firewall = {
allowedTCPPorts = [
80 # ledfx
4713 # pulseaudio/pipewire network sync
];
allowedUDPPorts = [
5353 # mdns
];
};
security.rtkit.enable = true;
services.pipewire = { services.pipewire = {
enable = true; enable = true;
@ -74,11 +95,10 @@
pulse.enable = true; pulse.enable = true;
}; };
security.rtkit.enable = true;
# tell Avahi to publish services like Pipewire/PulseAudio # tell Avahi to publish services like Pipewire/PulseAudio
services.avahi = { services.avahi = {
enable = true; enable = true;
nssmdns = true;
publish = { publish = {
enable = true; enable = true;
addresses = true; addresses = true;
@ -86,6 +106,8 @@
}; };
}; };
sound.enable = true;
system.activationScripts.enableLingering = lib.optionalString config.services.pipewire.pulse.enable ('' system.activationScripts.enableLingering = lib.optionalString config.services.pipewire.pulse.enable (''
rm -r /var/lib/systemd/linger rm -r /var/lib/systemd/linger
mkdir /var/lib/systemd/linger mkdir /var/lib/systemd/linger
@ -93,7 +115,8 @@
touch /var/lib/systemd/linger/k-ot touch /var/lib/systemd/linger/k-ot
''); '');
systemd.services.bluetooth-agent = lib.mkIf config.hardware.bluetooth.enable { systemd = {
services.bluetooth-agent = lib.mkIf config.hardware.bluetooth.enable {
description = "Allow anyone to pair via Bluetooth"; description = "Allow anyone to pair via Bluetooth";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
requires = [ "bluetooth.target" ]; requires = [ "bluetooth.target" ];
@ -105,6 +128,14 @@
RestartSec = 60; RestartSec = 60;
}; };
}; };
user.services.ledfx = {
after = [ "pipewire.target" ];
wantedBy = [ "default.target" ];
serviceConfig = {
ExecStart = "${pkgs.ledfx}/bin/ledfx";
};
};
};
users = { users = {
groups.pulse-access = { }; groups.pulse-access = { };