Created
August 1, 2023 20:25
-
-
Save telent/0747296ee8e3ddc43b44e6a5289cafe5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, lib, pkgs, ... }: | |
{ | |
imports = | |
[ # Include the results of the hardware scan. | |
./hardware-configuration.nix | |
]; | |
# Odroid C2 with Tow-Boot uses UEFI boot but has an MBR | |
# partition (not GPT) because the hardware needs firmware blobs | |
# in weird places that are incompatible with GPT layout. | |
# systemd-boot doesn't like this, but Grub doesn't grumble | |
boot.loader = { | |
systemd-boot.enable = false; | |
grub = { | |
enable=true; device = "nodev"; | |
efiSupport = true; efiInstallAsRemovable = true; | |
}; | |
efi.canTouchEfiVariables = false; | |
}; | |
# At time of writing this was 6.4.6 #1-NixOS . I'm not 100% sure | |
# this is needed, I may have added it in hope of solving some | |
# problem and not changed it back later. | |
boot.kernelPackages = pkgs.linuxPackages_latest; | |
networking.hostName = "tv"; | |
# This computer is plugged into a TV using HDMI, and has "one | |
# job"(sic): to provide a DLNA renderer (audio and video) so | |
# that a Jellyfin server elsewhere on the network can play | |
# movies/tv shows/etc on it. | |
# We use the mpv patch to gmrender-resurrect because it was a | |
# lot easier to get it working with accelerated fullscreen | |
# than gstreamer | |
systemd.services.renderer = | |
let | |
gmrender = pkgs.gmrender-resurrect.overrideAttrs(o: { | |
buildInputs = o.buildInputs ++ [pkgs.mpv]; | |
patches = (o.patches or []) ++ [ | |
(pkgs.fetchpatch { | |
url="https://github.com/hzeller/gmrender-resurrect/commit/2defd2afcae12f9528a9efb919ce816b6e1e0912.patch"; | |
hash = "sha256-dnRkBEUzyaZMJLLdmrWV8N+HqgiEbl0pRKGQfCEmJUA="; | |
}) | |
]; | |
}); | |
script = pkgs.writeShellApplication { | |
name = "gmrenderd"; | |
runtimeInputs = [ pkgs.mpv ]; | |
text = '' | |
exec ${gmrender}/bin/gmediarender --output mpv --friendly-name=tv --port=50001 --logfile stderr | |
''; | |
}; | |
in { | |
description = "DLNA renderer"; | |
wantedBy = [ "network-online.target" ]; | |
environment = { | |
XDG_RUNTIME_DIR = "/run/renderer"; | |
}; | |
serviceConfig = { | |
Restart = "always"; | |
RuntimeDirectory = "renderer"; | |
User = "renderer"; | |
DynamicUser = true; | |
SupplementaryGroups = [ | |
"video" | |
"audio" | |
]; | |
PrivateNetwork = false; | |
SyslogIdentifier = "renderer"; | |
ExecStart = "${script}/bin/gmrenderd"; | |
}; | |
}; | |
networking.firewall = { | |
allowedTCPPorts = [ 50001 ]; # gmediarender port | |
allowedUDPPorts = [ 1900 ]; # dlna discovery | |
logRefusedConnections = true; | |
enable = true; | |
}; | |
# Set your time zone. | |
time.timeZone = "Europe/London"; | |
# Enable sound. | |
sound.enable = true; | |
users.users.dan = { | |
isNormalUser = true; | |
extraGroups = [ | |
"wheel" # Enable ‘sudo’ for the user. | |
"video" | |
"audio" | |
]; | |
}; | |
# Enable the OpenSSH daemon. | |
services.openssh.enable = true; | |
system.stateVersion = "23.11"; # comment? what comment? | |
hardware.opengl = { | |
enable = true; driSupport = true; | |
extraPackages = []; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment