Add LedFx

This commit is contained in:
Jakob Lechner 2024-12-08 23:03:02 +01:00
parent be3127e7d2
commit 9ffcefc612
2 changed files with 58 additions and 0 deletions

View file

@ -7,6 +7,7 @@
./esphome
./home-assistant.nix
./jellyfin.nix
./ledfx.nix
./mail.nix
./matrix.nix
./mopidy.nix

View file

@ -0,0 +1,57 @@
args@{ lib, pkgs, config, custom-utils, ... }:
let
interfaces = import ../interfaces.nix;
in
{
networking.firewall.interfaces."${interfaces.lan}".allowedTCPPorts = [
8888
];
systemd.services.snapclient-ledfx = {
enable = true;
description = "Snapcast client";
wants = [ "network.target" "sound.target" ];
after = [ "network.target" "sound.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${pkgs.snapcast}/bin/snapclient --host 127.0.0.1 --hostID ledfx -i 2 --player alsa -s ledfx";
Group = "audio";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX";
RestrictNamespaces = true;
RuntimeDirectory = "snapclient-ledfx";
};
};
systemd.services.ledfx = {
enable = true;
description = "LedFx";
wants = [ "network.target" "sound.target" ];
after = [ "network.target" "sound.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${pkgs.ledfx}/bin/ledfx --host 0.0.0.0 -p 8888 -c %S/ledfx";
Group = "audio";
NoNewPrivileges = true;
ProtectControlGroups = true;
ProtectHome = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
RestrictAddressFamilies = "AF_INET AF_INET6 AF_UNIX";
RestrictNamespaces = true;
StateDirectory = "ledfx";
StateDirectoryMode = "0755";
};
};
boot.kernelModules = [ "snd-aloop" ];
boot.extraModprobeConfig = ''
options snd-aloop id=ledfx enable=1 pcm_substreams=1
'';
}