Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2d2731d6 | ||
|
|
91ea6863d7 | ||
|
|
341a168dc0 |
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" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -16,8 +16,5 @@ in
|
|||||||
systemd-boot.editor = false;
|
systemd-boot.editor = false;
|
||||||
efi.canTouchEfiVariables = true;
|
efi.canTouchEfiVariables = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Initrd
|
|
||||||
boot.initrd.systemd.enable = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -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 ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
# Render node of the GPU the OpenXR runtime uses, for hybrid graphics laptops
|
||||||
|
# (e.g. "/dev/dri/by-path/pci-0000:01:00.0-render"). Only NVIDIA is supported.
|
||||||
|
nvidiaRenderNode ? null,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Google Chrome with WebXR over OpenXR. nixpkgs' Chromium sets checkout_openxr = false,
|
||||||
|
# so it is built without the OpenXR backend.
|
||||||
|
let
|
||||||
|
chrome = pkgs.google-chrome;
|
||||||
|
|
||||||
|
flags = [
|
||||||
|
"--enable-features=OpenXR"
|
||||||
|
# The broker reports the wrong pid to SteamVR, which then fails xrCreateInstance
|
||||||
|
"--disable-seccomp-filter-sandbox"
|
||||||
|
"--ozone-platform=wayland"
|
||||||
|
"--use-angle=gl"
|
||||||
|
]
|
||||||
|
++ lib.optionals (nvidiaRenderNode != null) [
|
||||||
|
# The compositor runs on the integrated GPU and can't import NVIDIA buffers,
|
||||||
|
# so the window is composited in software while WebGL and WebXR stay on NVIDIA
|
||||||
|
"--render-node-override=${nvidiaRenderNode}"
|
||||||
|
"--disable-gpu-compositing"
|
||||||
|
];
|
||||||
|
|
||||||
|
desktopItem = pkgs.makeDesktopItem {
|
||||||
|
name = "chrome-xr";
|
||||||
|
exec = "chrome-xr %U";
|
||||||
|
icon = "google-chrome";
|
||||||
|
desktopName = "Chrome XR";
|
||||||
|
genericName = "WebXR Browser";
|
||||||
|
comment = "Google Chrome with WebXR through OpenXR";
|
||||||
|
categories = [
|
||||||
|
"Network"
|
||||||
|
"WebBrowser"
|
||||||
|
];
|
||||||
|
mimeTypes = [
|
||||||
|
"text/html"
|
||||||
|
"x-scheme-handler/http"
|
||||||
|
"x-scheme-handler/https"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "chrome-xr-${chrome.version}";
|
||||||
|
|
||||||
|
paths = [
|
||||||
|
(pkgs.writeShellScriptBin "chrome-xr" ''
|
||||||
|
# SteamVR's vrclient.so needs these, which NixOS doesn't provide globally
|
||||||
|
export LD_LIBRARY_PATH=${
|
||||||
|
lib.makeLibraryPath [
|
||||||
|
pkgs.libuuid
|
||||||
|
pkgs.libglvnd
|
||||||
|
]
|
||||||
|
}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||||
|
|
||||||
|
${lib.optionalString (nvidiaRenderNode != null) ''
|
||||||
|
# Render on the NVIDIA GPU, which the OpenXR runtime also uses
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||||
|
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||||
|
export __EGL_VENDOR_LIBRARY_FILENAMES=/run/opengl-driver/share/glvnd/egl_vendor.d/10_nvidia.json
|
||||||
|
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||||
|
''}
|
||||||
|
|
||||||
|
# Separate profile, as the seccomp sandbox is disabled
|
||||||
|
exec ${chrome}/bin/google-chrome-stable \
|
||||||
|
${lib.escapeShellArgs flags} \
|
||||||
|
--user-data-dir="''${XDG_CONFIG_HOME:-$HOME/.config}/chrome-xr" \
|
||||||
|
"$@"
|
||||||
|
'')
|
||||||
|
desktopItem
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = chrome.meta // {
|
||||||
|
description = "Google Chrome with WebXR through OpenXR";
|
||||||
|
mainProgram = "chrome-xr";
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in new issue
Block a user