Files
nixconf/hosts/pi-htpc/configuration.nix
T
2026-03-13 21:52:58 -06:00

100 lines
2.4 KiB
Nix
Executable File

{ pkgs, ... }:
let
kodi-with-addons = pkgs.kodi-wayland.withPackages (kodiPkgs: with kodiPkgs; [
inputstream-adaptive
inputstream-ffmpegdirect
inputstream-rtmp
inputstreamhelper
bluetooth-manager
vfs-sftp
vfs-rar
vfs-libarchive
urllib3
upnext
trakt
trakt-module
sponsorblock
invidious
simplecache
libretro
libretro-snes9x
libretro-nestopia
jellycon
archive_tool
joystick
keymap
osmc-skin
jellyfin
visualization-projectm
visualization-goom
visualization-fishbmc
visualization-matrix
visualization-pictureit
visualization-shadertoy
visualization-spectrum
visualization-starburst
visualization-waveform
]);
in
{
networking.hostName = "htpc";
# hdmi cec
nixpkgs.overlays = [
(self: super: { libcec = super.libcec.override { withLibraspberrypi = true; }; })
];
environment.systemPackages = with pkgs; [
libcec
];
services.udev.extraRules = ''
# allow access to raspi cec device for video group (and optionally register it as a systemd device, used below)
KERNEL=="vchiq", GROUP="video", MODE="0660", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/dev/vchiq"
'';
systemd.sockets."cec-client" = {
after = [ "dev-vchiq.device" ];
bindsTo = [ "dev-vchiq.device" ];
wantedBy = [ "sockets.target" ];
socketConfig = {
ListenFIFO = "/run/cec.fifo";
SocketGroup = "video";
SocketMode = "0660";
};
};
systemd.services."cec-client" = {
after = [ "dev-vchiq.device" ];
bindsTo = [ "dev-vchiq.device" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''${pkgs.libcec}/bin/cec-client -d 1'';
ExecStop = ''/bin/sh -c "echo q > /run/cec.fifo"'';
StandardInput = "socket";
StandardOutput = "journal";
Restart="no";
};
};
# kde connect for remote ctrl
programs.kdeconnect.enable = true;
# kodi
services.cage.user = "k3t";
services.cage.extraArguments = [ "-m" "last" "-d" ];
services.cage.program = "${kodi-with-addons}/bin/kodi-standalone";
services.cage.enable = true;
# audio
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = false;
pulse.enable = true;
};
# gpu
hardware.raspberry-pi."4".fkms-3d.enable = true;
hardware.graphics.enable = true;
}