Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ba339d2
Use systemd-boot instead of grub
archessmn Aug 30, 2025
dd8dd92
Make a proper live env
archessmn Aug 30, 2025
46b2022
Fix getty autologin
archessmn Aug 30, 2025
eaea2ea
Name image consistently
archessmn Aug 30, 2025
779952f
Enable decklink support and include ffmpeg
archessmn Aug 30, 2025
15545c8
Update option name for iso image name
archessmn Aug 30, 2025
0a0fb8d
Don't set bootloader settings
archessmn Aug 30, 2025
72ea585
Try making image bootable
archessmn Aug 30, 2025
a4bf7c4
Add WiFi autoconnect and drivers
archessmn Aug 30, 2025
a8a38ff
Allow broadcom drivers
archessmn Aug 30, 2025
121216d
Move allowed driver to flake
archessmn Aug 30, 2025
51d7273
Fix wifi secret
archessmn Aug 30, 2025
fc94e75
Mess with secrets
archessmn Aug 30, 2025
87f16b7
Give up on secrets for now
archessmn Aug 31, 2025
238c138
Test stream to mediamtx
archessmn Aug 31, 2025
3ad2683
Fix CA certs because apparently that's a problem
archessmn Aug 31, 2025
bdc36bd
Incorrect package name
archessmn Aug 31, 2025
717573f
Add plugins to plugin path env
archessmn Aug 31, 2025
73a12f1
Add all plugins to path
archessmn Aug 31, 2025
cfc32de
Add gstreamer base to plugin path
archessmn Aug 31, 2025
e97aef1
It needs this version of the package
archessmn Aug 31, 2025
535d64e
Add LD_LIBRARY_PATH for desktop video
archessmn Aug 31, 2025
be09870
Fix the streaming script to sync video and audio
archessmn Sep 2, 2025
c2fa3c7
Try with script that worked
archessmn Sep 14, 2025
ca1aa93
Change to ffmpeg
archessmn Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};

minegrub-theme.url = "github:Lxtharia/minegrub-theme";
};

outputs =
inputs@{
nixpkgs,
home-manager,
agenix,
minegrub-theme,
...
}:
let
Expand All @@ -34,6 +31,9 @@
inherit system;
config = {
allowUnfree = true;
permittedInsecurePackages = [
"broadcom-sta-6.30.223.271-57-6.12.43"
];
};
};

Expand All @@ -46,7 +46,6 @@

commonModules = [
# home-manager.nixosModules.home-manager
inputs.minegrub-theme.nixosModules.default
agenix.nixosModules.default
];
in
Expand All @@ -66,8 +65,11 @@
remote-encoder = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = sharedArgs;
modules = commonModules ++ [
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/iso-image.nix"
{
image.fileName = "nixos-remote-encoder.iso";

nixpkgs.pkgs = stable-pkgs;
}
./remote-encoder
Expand Down
112 changes: 94 additions & 18 deletions remote-encoder/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
# Just testing something
# ffmpeg -f decklink -i 'DeckLink Mini Recorder 4K' -c:v libx264 -preset ultrafast -tune zerolatency -pix_fmt yuv420p -profile:v high -level 4.2 -b:v 25M -maxrate 25M -bufsize 25M -g 50 -keyint_min 50 -sc_threshold 0 -c:a aac -ar 48000 -b:a 128k -muxdelay 0 -muxpreload 0 -f mpegts "srt://host.moir.xyz:6969?streamid=publish:zenith&latency=125&pkt_size=1316"

{
inputs,
Expand All @@ -14,6 +15,31 @@
let
locale = "en_GB.UTF-8";
timezone = "Europe/London";

decklink-sdk = pkgs.callPackage ../blackmagic/decklink-sdk.nix { };

ffmpeg-decklink = pkgs.ffmpeg.overrideAttrs (oldAttrs: {
configureFlags = oldAttrs.configureFlags ++ [
"--enable-nonfree"
"--enable-decklink"
];
nativeBuildInputs = oldAttrs.nativeBuildInputs or [ ] ++ [
pkgs.makeWrapper
];
buildInputs = oldAttrs.buildInputs ++ [
pkgs.blackmagic-desktop-video
decklink-sdk
];

postFixup = ''
patchelf --add-rpath ${pkgs.libGL}/lib $lib/lib/libavcodec.so
patchelf --add-rpath ${pkgs.libGL}/lib $lib/lib/libavutil.so

wrapProgram $bin/bin/ffmpeg \
--prefix LD_LIBRARY_PATH : ${pkgs.blackmagic-desktop-video}/lib
'';

});
in
{
nix.settings.experimental-features = [
Expand All @@ -22,22 +48,12 @@ in
];
nix.settings.trusted-users = [ "broadcast" ];

# Bootloader.
boot.loader = {
efi = {
canTouchEfiVariables = true;
};
grub = {
efiSupport = true;
device = lib.mkDefault "nodev";
minegrub-theme = {
enable = true;
splash = "100% flakes!";
background = "background_options/1.8 - [Classic Minecraft].png";
boot-options-count = 4;
};
};
};
boot.kernelModules = [ "wl" ];
hardware.enableRedistributableFirmware = true;
boot.extraModulePackages = with pkgs.linuxPackages; [ broadcom_sta ];

isoImage.makeEfiBootable = true;
isoImage.makeUsbBootable = true;

environment.enableAllTerminfo = true;

Expand All @@ -55,10 +71,31 @@ in
];

networking.hostName = "ystv-remote-encoder"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

networking.networkmanager.enable = true;

networking.networkmanager.ensureProfiles = {
profiles = {
"mydevices-wifi" = {
connection = {
id = "mydevices-wifi";
type = "wifi";
autoconnect = true;
};
wifi = {
ssid = "mydevices";
mode = "infrastructure";
};
wifi-security = {
key-mgmt = "wpa-psk";
# This is not really a secret as just knowing this provides no access to the network
# Any devices using this must be registered on mydevices
psk = "connectme";
};
};
};
};

time.timeZone = "${timezone}";

# Select internationalisation properties
Expand Down Expand Up @@ -87,7 +124,15 @@ in
"docker"
];
ignoreShellProgramCheck = true;
shell = pkgs.zsh;
hashedPassword = "$y$j9T$Z6/JnpXpDqRCvgFs6O/Fq0$aVgg./1VNie8Gy7EKh0auuNp3e/NwEqjdJSmDuLLrJ/";
shell = pkgs.bashInteractive;
};

users.users.root.hashedPassword = "$y$j9T$uphD.j1c70afhycuLzw0B1$4xwBe7QHAgEfJHtXQIXtFiQTVuMSDPnwvHsQKFmtai8";

services.getty = {
autologinOnce = true;
autologinUser = "broadcast";
};

environment.systemPackages = with pkgs; [
Expand All @@ -96,8 +141,37 @@ in
curl
dig
speedtest-cli
ffmpeg-decklink
bashInteractive

cacert

blackmagic-desktop-video
];

systemd.services.decklink-srt-stream = {
enable = true;
description = "Stream DeckLink input to MediaMTX over SRT";
after = [ "network-online.target" ];
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];

serviceConfig = {
ExecStart = ''
${ffmpeg-decklink}/bin/ffmpeg -f decklink -i 'DeckLink Mini Recorder 4K'
-c:v libx264 -preset ultrafast -tune zerolatency
-pix_fmt yuv420p -profile:v high -level 4.2
-b:v 25M -maxrate 25M -bufsize 25M
-g 50 -keyint_min 50 -sc_threshold 0
-c:a aac -ar 48000 -b:a 128k
-muxdelay 0 -muxpreload 0
-f mpegts "srt://host.moir.xyz:6969?streamid=publish:zenith&latency=125&pkt_size=1316"
'';
Restart = "always";
RestartSec = "5s";
};
};

services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
Expand All @@ -106,6 +180,8 @@ in

system.stateVersion = "25.05";

hardware.decklink.enable = true;

services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
Expand Down
14 changes: 14 additions & 0 deletions secrets/secrets.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
let
ops = {
nix-builder = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM32qDHEY8Aswp8/mbs7JPgtduHNcTdR7zRR7c9vbjpZ ops@nix-builder";
};
archessmn = {
helios = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAKbv0CfhD/1mE+OORtFtHcj9PA3Gal6S/+czXp82B0t archessmn@helios";
};
in
{
"wifi-mydevices-password.age".publicKeys = [
ops.nix-builder
archessmn.helios
];
}
7 changes: 7 additions & 0 deletions secrets/wifi-mydevices-password.age
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
age-encryption.org/v1
-> ssh-ed25519 nJW4zQ h5OA3v6/1ffSr5F4YQVEOtk2BmOqTag3IaXX+2W3Skg
1/jlCSo3v5IpAl2Ey/hWCd/aRYH3uzFoIgbqxi8LaaA
-> ssh-ed25519 Kn/Vww yB9VeYhw0xNm78QyCCHiHMdZnesM25hA+bnv6uuMfRk
0lavCUlqDnoWqbCnncS4s8KTqn/v3Q7r5l3w5fQaXO0
--- aswuBu8o8zY0aG8KVGHZ1fRnmPJknkn5usI7rTqdg6s
cq��܃Kbџ�%_J�|���3�Bh~�����2��JZ�|#- O&�2@�Gs�]