audio-server: drop 22.11/23.05 compat code

This commit is contained in:
Sandro - 2023-12-10 01:32:42 +01:00
parent 8d23d4cf67
commit 8e18277b8d
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5
2 changed files with 42 additions and 56 deletions

View File

@ -238,16 +238,13 @@
inherit system; inherit system;
modules = [ modules = [
({ pkgs, ... }: { {
_module.args = { _module.args = {
inherit hostRegistry libC nixos ssh-public-keys zentralwerk; inherit hostRegistry libC nixos ssh-public-keys zentralwerk;
# TODO: drop!
is2305 = (lib.versions.majorMinor pkgs.lib.version) == "23.05";
}; };
nixpkgs.overlays = overlayList; nixpkgs.overlays = overlayList;
}) }
self.nixosModules.c3d2 self.nixosModules.c3d2
] ++ modules; ] ++ modules;

View File

@ -1,6 +1,21 @@
{ config, is2305, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.c3d2.audioServer;
in
{
options.c3d2.audioServer = {
enable = lib.mkEnableOption "PulseAudio and Bluetooth sinks";
ledfx = lib.mkEnableOption "LedFX service";
};
config = lib.mkIf cfg.enable {
boot.kernelPackages = lib.mkOverride 900 pkgs.linuxPackages-rt_latest;
environment = {
etc."pipewire/pipewire.conf.d/audio-server.conf".text = let
pactl = "${pkgs.pulseaudio}/bin/pactl";
# _____ _______ ____ _____ # _____ _______ ____ _____
# / ____|__ __/ __ \| __ \ # / ____|__ __/ __ \| __ \
# | (___ | | | | | | |__) | # | (___ | | | | | | |__) |
@ -11,10 +26,8 @@ let
# errors such as: # errors such as:
# mod.zeroconf-publish: error id:47 seq:349 res:-2 (No such file or directory): enum params id:16 (Spa:Enum:ParamId:ProcessLatency) failed # mod.zeroconf-publish: error id:47 seq:349 res:-2 (No such file or directory): enum params id:16 (Spa:Enum:ParamId:ProcessLatency) failed
# are harmless and can be ignored. You most likely want to restart your local avahi-daemon: sudo systemctl restart avahi-daemon # are harmless and can be ignored. You most likely want to restart your local avahi-daemon: sudo systemctl restart avahi-daemon
pipewireCfg = contextExec: let in builtins.toJSON {
pactl = "${pkgs.pulseaudio}/bin/pactl"; "context.exec" = [
in {
"context.exec" = contextExec ++ [
# should be loaded by "server.address" but that is either to late or razy on 23.05 # should be loaded by "server.address" but that is either to late or razy on 23.05
{ {
"path" = pactl; "path" = pactl;
@ -41,23 +54,6 @@ let
]; ];
}; };
}; };
cfg = config.c3d2.audioServer;
in
{
options.c3d2.audioServer = {
enable = lib.mkEnableOption "PulseAudio and Bluetooth sinks";
ledfx = lib.mkEnableOption "LedFX service";
};
config = lib.mkIf cfg.enable {
boot.kernelPackages = lib.mkOverride 900 pkgs.linuxPackages-rt_latest;
environment = {
etc = lib.optionalAttrs is2305 {
"pipewire/pipewire.conf.d/audio-server.conf".text = builtins.toJSON (pipewireCfg [ ]);
};
systemPackages = with pkgs; [ systemPackages = with pkgs; [
mpd mpd
mpv mpv
@ -160,13 +156,6 @@ in
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = lib.mkIf cfg.ledfx true; # required for ledfx alsa.enable = lib.mkIf cfg.ledfx true; # required for ledfx
config = lib.mkIf (!is2305) {
pipewire-pulse =
let
default-pipewire-pulse = lib.importJSON (pkgs.path + "/nixos/modules/services/desktops/pipewire/daemon/pipewire-pulse.conf.json");
in
default-pipewire-pulse // (pipewireCfg default-pipewire-pulse."context.exec");
};
pulse.enable = true; pulse.enable = true;
}; };