feat: steam frame setup
This commit is contained in:
5 files changed
+221
No files matched your search
@@ -27,9 +27,16 @@
|
|||||||
"wireshark"
|
"wireshark"
|
||||||
"podman"
|
"podman"
|
||||||
"libvirtd"
|
"libvirtd"
|
||||||
|
"networkmanager"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Steam Frame wireless adapter
|
||||||
|
modules.steam-frame = {
|
||||||
|
enable = true;
|
||||||
|
regulatoryDomain = "NL";
|
||||||
|
};
|
||||||
|
|
||||||
# Set up impermanence
|
# Set up impermanence
|
||||||
modules.impermanence = {
|
modules.impermanence = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -8,6 +8,18 @@
|
|||||||
|
|
||||||
modules.profiles.jan.enable = true;
|
modules.profiles.jan.enable = true;
|
||||||
|
|
||||||
|
# Open Beat Saber OneClick links on the Steam Frame
|
||||||
|
modules.beatsaber-oneclick = {
|
||||||
|
enable = true;
|
||||||
|
host = "steamos@frame.local";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Larger text while the desktop is streamed to the Steam Frame
|
||||||
|
modules.steam-frame-desktop = {
|
||||||
|
enable = true;
|
||||||
|
streamingTextScale = 1.2;
|
||||||
|
};
|
||||||
|
|
||||||
# home.packages = with pkgs; [
|
# home.packages = with pkgs; [
|
||||||
# opencloud-desktop
|
# opencloud-desktop
|
||||||
# code-nautilus
|
# code-nautilus
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.beatsaber-oneclick;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.beatsaber-oneclick = {
|
||||||
|
enable = mkEnableOption "forwarding Beat Saber OneClick links to a Steam Frame";
|
||||||
|
|
||||||
|
host = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "steamos@frame.local";
|
||||||
|
description = "SSH destination of the Steam Frame. Needs key auth, as there is no terminal to ask for a password.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# The schemes BSManager handles on the Frame. Registering them here makes
|
||||||
|
# browsers on this machine hand the links to the Frame.
|
||||||
|
xdg.desktopEntries.beatsaber-oneclick = {
|
||||||
|
name = "Beat Saber OneClick (Steam Frame)";
|
||||||
|
comment = "Install Beat Saber maps and playlists on the Steam Frame";
|
||||||
|
type = "Application";
|
||||||
|
exec = "${pkgs.beatsaber-oneclick}/bin/beatsaber-oneclick ${escapeShellArg cfg.host} %u";
|
||||||
|
terminal = false;
|
||||||
|
noDisplay = true;
|
||||||
|
mimeType = [
|
||||||
|
"x-scheme-handler/beatsaver"
|
||||||
|
"x-scheme-handler/bsplaylist"
|
||||||
|
"x-scheme-handler/web+bsmap"
|
||||||
|
"x-scheme-handler/modelsaber"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.steam-frame-desktop;
|
||||||
|
|
||||||
|
log = "${config.xdg.dataHome}/Steam/logs/streaming_log.txt";
|
||||||
|
|
||||||
|
setScale = scale: "${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface text-scaling-factor ${toString scale}";
|
||||||
|
|
||||||
|
# Follows Steam's streaming log, which marks when a desktop stream starts and stops
|
||||||
|
# (Remote Play "Connect" on the Frame, or the desktop view in PC VR)
|
||||||
|
watcher = pkgs.writeShellScript "steam-frame-desktop-scale" ''
|
||||||
|
${pkgs.coreutils}/bin/tail -n 0 -F ${escapeShellArg log} 2>/dev/null | while IFS= read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
*">>> Starting desktop stream"*)
|
||||||
|
${setScale cfg.streamingTextScale} ;;
|
||||||
|
# Also reset when Steam restarts, in case it quit mid-stream
|
||||||
|
*">>> Stopped desktop stream"* | *"Client version:"*)
|
||||||
|
${setScale cfg.normalTextScale} ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.steam-frame-desktop = {
|
||||||
|
enable = mkEnableOption "larger text while the desktop is streamed to a Steam Frame";
|
||||||
|
|
||||||
|
streamingTextScale = mkOption {
|
||||||
|
type = types.float;
|
||||||
|
default = 1.44;
|
||||||
|
description = "GNOME text scaling factor while the desktop is being streamed.";
|
||||||
|
};
|
||||||
|
|
||||||
|
normalTextScale = mkOption {
|
||||||
|
type = types.float;
|
||||||
|
default = 1.0;
|
||||||
|
description = "GNOME text scaling factor otherwise.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.user.services.steam-frame-desktop-scale = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Scale text up while the desktop is streamed to a Steam Frame";
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${watcher}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.steam-frame;
|
||||||
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
|
|
||||||
|
# Out-of-tree rtw89 driver, as the in-tree rtw89_8852cu driver needs Linux 7.0+,
|
||||||
|
# which ZFS does not support yet
|
||||||
|
rtw89 = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "rtw89-morrownr";
|
||||||
|
version = "0-unstable-2026-11-09-${kernel.version}";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "morrownr";
|
||||||
|
repo = "rtw89";
|
||||||
|
rev = "f2ce66eda6277e5505d5914a8a08454440518702";
|
||||||
|
hash = "sha256-u2sJ/1tvDM6MloulU7l3w9eLCc2GZqOBebI7/eQbeC8=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||||
|
makeFlags = kernel.commonMakeFlags ++ [
|
||||||
|
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||||
|
];
|
||||||
|
buildFlags = [ "modules" ];
|
||||||
|
|
||||||
|
# Install through Kbuild so the modules are signed (produces the .ko.cer files)
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
local flagsArray=()
|
||||||
|
concatTo flagsArray makeFlags
|
||||||
|
make "''${flagsArray[@]}" -C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build M=$PWD \
|
||||||
|
modules_install INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=updates/rtw89
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.steam-frame = {
|
||||||
|
enable = mkEnableOption "Steam Frame wireless streaming adapter";
|
||||||
|
|
||||||
|
regulatoryDomain = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "Country code to use for Wi-Fi, needed to unlock the 6 GHz band.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Driver for the adapter (Realtek RTL8832CU, 28de:2432)
|
||||||
|
# Firmware comes from linux-firmware (hardware.enableRedistributableFirmware)
|
||||||
|
boot.extraModulePackages = [ rtw89 ];
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
options cfg80211 ieee80211_regdom=${cfg.regulatoryDomain}
|
||||||
|
|
||||||
|
# The adapter tends to stall when it enters power saving
|
||||||
|
options rtw89_core_git disable_ps_mode=y
|
||||||
|
|
||||||
|
# Prevent the in-tree drivers from claiming the adapter
|
||||||
|
blacklist rtw89_core
|
||||||
|
blacklist rtw89_usb
|
||||||
|
blacklist rtw89_8852c
|
||||||
|
blacklist rtw89_8852cu
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Never let the adapter doze. In power save the Frame (the access point) buffers
|
||||||
|
# traffic for the PC until it wakes up, which stalls streams towards the PC
|
||||||
|
# such as spectating. This overrides the global wifi.powersave for this driver only.
|
||||||
|
networking.networkmanager.settings."connection-steam-frame" = {
|
||||||
|
match-device = "driver:rtw89_8852cu_git";
|
||||||
|
"wifi.powersave" = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Udev rules for Valve devices
|
||||||
|
hardware.steam-hardware.enable = true;
|
||||||
|
|
||||||
|
# Streaming ports
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [ 27036 ];
|
||||||
|
allowedUDPPortRanges = [
|
||||||
|
{
|
||||||
|
from = 10400;
|
||||||
|
to = 10401;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
from = 27031;
|
||||||
|
to = 27036;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.iw ];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user