Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f1bd5146a3 | |||
| 6f35d60aab |
@@ -1,25 +1,15 @@
|
|||||||
# Monitor layout for 14900k.
|
# Monitor layout for 14900k.
|
||||||
# NVIDIA (default): DP-3 ultrawide, HDMI-A-3 + DP-4 side/top stack; DP-2 virtual 4K when streamingDisplay enabled.
|
# NVIDIA (default): DP-3 ultrawide, HDMI-A-3 + DP-4 stack; DP-2 virtual 4K when streamingDisplay is on.
|
||||||
# Intel iGPU (gpu passthru): DP-1 ultrawide, HDMI-A-2 Samsung to the left.
|
# Intel iGPU (gpu passthru): DP-1 ultrawide, HDMI-A-2 to the left.
|
||||||
# Niri: `extraSettings` (KDL via `extraConfig`, other wrapper-modules keys) + `extraBinds` (merged keybinds).
|
# Niri uses `extraSettings.extraConfig`; Hyprland uses `chiasson.desktop.hyprland.settings`.
|
||||||
# Hyprland: `chiasson.desktop.hyprland.settings` (merged in HM when `chiasson.desktop.hyprland.enable`).
|
|
||||||
|
|
||||||
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
#TODO[epic=Moderate] Clean this up, move to host's configuration.nix.
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
let
|
let
|
||||||
|
streamingDisplay = config.chiasson.system.streamingDisplay;
|
||||||
gpuPassthru = config.chiasson.system.gpuPassthru.enable;
|
gpuPassthru = config.chiasson.system.gpuPassthru.enable;
|
||||||
streamingDisplay = config.chiasson.system.streamingDisplay.enable or false;
|
|
||||||
streamingCfg = config.chiasson.system.streamingDisplay or { };
|
|
||||||
|
|
||||||
virtualOutputNiri =
|
|
||||||
lib.optionalString streamingDisplay ''
|
|
||||||
output "${streamingCfg.connector}" {
|
|
||||||
mode "${streamingCfg.mode}"
|
|
||||||
scale ${toString (streamingCfg.niriScale or 1.0)}
|
|
||||||
position ${streamingCfg.niriPosition}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
# Niri outputs: a static block per GPU layout, plus the optional virtual 4K panel.
|
||||||
niriOutputs =
|
niriOutputs =
|
||||||
(if gpuPassthru then
|
(if gpuPassthru then
|
||||||
''
|
''
|
||||||
@@ -54,48 +44,30 @@ let
|
|||||||
position x=0 y=-1080
|
position x=0 y=-1080
|
||||||
}
|
}
|
||||||
'')
|
'')
|
||||||
+ virtualOutputNiri;
|
+ lib.optionalString streamingDisplay.enable ''
|
||||||
|
output "${streamingDisplay.connector}" {
|
||||||
virtualOutputHyprland =
|
mode "${streamingDisplay.mode}"
|
||||||
lib.optionalString streamingDisplay
|
scale ${toString streamingDisplay.niriScale}
|
||||||
"${streamingCfg.connector}, ${streamingCfg.mode}, 7680x0, ${toString (streamingCfg.niriScale or 1.0)}";
|
position ${streamingDisplay.niriPosition}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Hyprland monitor strings, with the virtual panel appended when enabled.
|
||||||
hyprlandMonitors =
|
hyprlandMonitors =
|
||||||
(if gpuPassthru then
|
(if gpuPassthru then
|
||||||
[
|
[ "DP-1, 2560x1080@144, 0x0, 1" "HDMI-A-2, 1920x1080@60, -1920x0, 1" ]
|
||||||
"DP-1, 2560x1080@144, 0x0, 1"
|
|
||||||
"HDMI-A-2, 1920x1080@60, -1920x0, 1"
|
|
||||||
]
|
|
||||||
else
|
else
|
||||||
[
|
[ "DP-3, 2560x1080@144, 0x0, 1" "DP-4, 1920x1080@144, 0x-1080, 1" "HDMI-A-3, 1920x1080@60, -1920x0, 1" ])
|
||||||
"DP-3, 2560x1080@144, 0x0, 1"
|
++ lib.optional streamingDisplay.enable "${streamingDisplay.connector}, ${streamingDisplay.mode}, 7680x0, ${toString streamingDisplay.niriScale}";
|
||||||
"DP-4, 1920x1080@144, 0x-1080, 1"
|
|
||||||
"HDMI-A-3, 1920x1080@60, -1920x0, 1"
|
|
||||||
])
|
|
||||||
++ lib.optional streamingDisplay virtualOutputHyprland;
|
|
||||||
|
|
||||||
hyprlandWorkspaces =
|
hyprlandWorkspaces =
|
||||||
if gpuPassthru then
|
if gpuPassthru then
|
||||||
[
|
[ "1, monitor:DP-1, default:true" "2, monitor:DP-1" "3, monitor:DP-1"
|
||||||
"1, monitor:DP-1, default:true"
|
"4, monitor:HDMI-A-2, default:true" "5, monitor:HDMI-A-2" "6, monitor:HDMI-A-2" ]
|
||||||
"2, monitor:DP-1"
|
|
||||||
"3, monitor:DP-1"
|
|
||||||
"4, monitor:HDMI-A-2, default:true"
|
|
||||||
"5, monitor:HDMI-A-2"
|
|
||||||
"6, monitor:HDMI-A-2"
|
|
||||||
]
|
|
||||||
else
|
else
|
||||||
[
|
[ "1, monitor:DP-3, default:true" "2, monitor:DP-3" "3, monitor:DP-3"
|
||||||
"1, monitor:DP-3, default:true"
|
"4, monitor:HDMI-A-3, default:true" "5, monitor:HDMI-A-3" "6, monitor:HDMI-A-3"
|
||||||
"2, monitor:DP-3"
|
"7, monitor:DP-4" "8, monitor:DP-4" "9, monitor:DP-4" ];
|
||||||
"3, monitor:DP-3"
|
|
||||||
"4, monitor:HDMI-A-3, default:true"
|
|
||||||
"5, monitor:HDMI-A-3"
|
|
||||||
"6, monitor:HDMI-A-3"
|
|
||||||
"7, monitor:DP-4"
|
|
||||||
"8, monitor:DP-4"
|
|
||||||
"9, monitor:DP-4"
|
|
||||||
];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
chiasson.desktop.niri.extraSettings = {
|
chiasson.desktop.niri.extraSettings = {
|
||||||
@@ -103,10 +75,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
chiasson.desktop.niri.extraBinds."XF86Tools".spawn = [
|
chiasson.desktop.niri.extraBinds."XF86Tools".spawn = [
|
||||||
"wpctl"
|
"wpctl" "set-mute" "@DEFAULT_AUDIO_SOURCE@" "toggle"
|
||||||
"set-mute"
|
|
||||||
"@DEFAULT_AUDIO_SOURCE@"
|
|
||||||
"toggle"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
chiasson.desktop.hyprland.settings = lib.mkIf config.chiasson.desktop.hyprland.enable {
|
chiasson.desktop.hyprland.settings = lib.mkIf config.chiasson.desktop.hyprland.enable {
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
# Headless 4K virtual output for Sunshine → Moonlight on a client TV.
|
# Headless 4K virtual output for Sunshine → Moonlight on a client TV.
|
||||||
#
|
#
|
||||||
# NVIDIA proprietary driver: both kernel params are required —
|
# NVIDIA: force-enable a spare DRM connector with a custom EDID via kernel params:
|
||||||
# video=<connector>:e force-enables the connector
|
# video=<connector>:e force-enables the connector
|
||||||
# drm.edid_firmware=<connector>:… loads modes from the EDID blob
|
# drm.edid_firmware=<connector>:… loads modes from the EDID blob
|
||||||
#
|
#
|
||||||
# Pick a connector that is disconnected on the host (check after boot):
|
# Capture is pinned to the connector by name (Sunshine `output_name`), which is
|
||||||
# grep -H . /sys/class/drm/card*-*/status
|
# stable across reboots/hotplug — unlike a numeric monitor index.
|
||||||
#
|
# Reboot after changing connector or EDID. 4K@60 is realistic on RTX 2070.
|
||||||
# Reboot after changing connector or EDID. 4K@60 is realistic on RTX 2070;
|
|
||||||
# 4K@120 on a sink-less connector needs driver patches (see NVIDIA issue #1184).
|
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.chiasson.system.streamingDisplay;
|
cfg = config.chiasson.system.streamingDisplay;
|
||||||
@@ -16,14 +14,13 @@ let
|
|||||||
edidFirmware = pkgs.runCommand "sunshine-virtual-4k-edid" {
|
edidFirmware = pkgs.runCommand "sunshine-virtual-4k-edid" {
|
||||||
nativeBuildInputs = [ pkgs.python3 ];
|
nativeBuildInputs = [ pkgs.python3 ];
|
||||||
} ''
|
} ''
|
||||||
${pkgs.python3}/bin/python3 ${./generate-virtual-edid.py} $TMPDIR/${cfg.edidFileName}
|
|
||||||
mkdir -p $out/lib/firmware/edid
|
mkdir -p $out/lib/firmware/edid
|
||||||
cp $TMPDIR/${cfg.edidFileName} $out/lib/firmware/edid/${cfg.edidFileName}
|
${pkgs.python3}/bin/python3 ${./generate-virtual-edid.py} $out/lib/firmware/edid/${cfg.edidFileName}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Sunshine 2025.924 wlr capture only accepts a numeric monitor index (not "DP-2").
|
# On stream start: scale + focus the virtual 4K output so streamed windows
|
||||||
# If the index drifts after hotplug, check:
|
# land there. Capture is pinned to the connector via Sunshine `output_name`,
|
||||||
# journalctl --user -u sunshine -b | rg 'Monitor [0-9]+ is'
|
# so no fragile numeric-index detection is needed.
|
||||||
streamDisplayUp = pkgs.writeShellScriptBin "stream-display-up" ''
|
streamDisplayUp = pkgs.writeShellScriptBin "stream-display-up" ''
|
||||||
${pkgs.niri}/bin/niri msg output ${cfg.connector} scale ${toString cfg.niriScale}
|
${pkgs.niri}/bin/niri msg output ${cfg.connector} scale ${toString cfg.niriScale}
|
||||||
${pkgs.niri}/bin/niri msg action focus-monitor ${cfg.connector}
|
${pkgs.niri}/bin/niri msg action focus-monitor ${cfg.connector}
|
||||||
@@ -87,18 +84,6 @@ in
|
|||||||
default = "DP-3";
|
default = "DP-3";
|
||||||
description = "Niri monitor to refocus when a Moonlight session ends.";
|
description = "Niri monitor to refocus when a Moonlight session ends.";
|
||||||
};
|
};
|
||||||
|
|
||||||
sunshineOutputIndex = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "3";
|
|
||||||
example = "3";
|
|
||||||
description = ''
|
|
||||||
Wayland/wlr monitor index for Sunshine `output_name`. Sunshine 2025.924 ignores
|
|
||||||
connector strings like `DP-2` and falls back to monitor 0 (your primary).
|
|
||||||
Find the index with:
|
|
||||||
`journalctl --user -u sunshine -b | rg "Monitor [0-9]+ is ${cfg.connector}"`
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||||
@@ -118,7 +103,11 @@ in
|
|||||||
(lib.mkIf config.chiasson.system.gaming.sunshine.enable {
|
(lib.mkIf config.chiasson.system.gaming.sunshine.enable {
|
||||||
services.sunshine.settings = {
|
services.sunshine.settings = {
|
||||||
capture = "wlr";
|
capture = "wlr";
|
||||||
output_name = cfg.sunshineOutputIndex;
|
# Pin capture to the virtual display by connector name (stable across
|
||||||
|
# reboots/hotplug). A numeric index drifted to the ultrawide before.
|
||||||
|
output_name = cfg.connector;
|
||||||
|
# RTX 2070 has no AV1 NVENC; avoid probing av1_nvenc.
|
||||||
|
encoder = "hevc_nvenc,h264_nvenc";
|
||||||
global_prep_cmd = "[{\"do\":\"${streamDisplayUp}/bin/stream-display-up\",\"undo\":\"${streamDisplayDown}/bin/stream-display-down\"}]";
|
global_prep_cmd = "[{\"do\":\"${streamDisplayUp}/bin/stream-display-up\",\"undo\":\"${streamDisplayDown}/bin/stream-display-down\"}]";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,10 +17,9 @@
|
|||||||
++ lib.optionals pkgs.stdenv.isx86_64 [ heroic ];
|
++ lib.optionals pkgs.stdenv.isx86_64 [ heroic ];
|
||||||
|
|
||||||
steamExtraPkgs =
|
steamExtraPkgs =
|
||||||
if !cfg.steam.steamTinkerLaunch.enable then
|
lib.optional (cfg.steam.steamTinkerLaunch.enable && lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch;
|
||||||
[ ]
|
|
||||||
else
|
launcherSet = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
||||||
lib.optional (lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.steamtinkerlaunch) pkgs.steamtinkerlaunch;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.chiasson.system.gaming = {
|
options.chiasson.system.gaming = {
|
||||||
@@ -194,11 +193,11 @@
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
(lib.mkIf (cfg.launchers.forUsers == null) {
|
(lib.mkIf (cfg.launchers.forUsers == null) {
|
||||||
environment.systemPackages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
environment.systemPackages = launcherSet;
|
||||||
})
|
})
|
||||||
(lib.mkIf (cfg.launchers.forUsers != null) {
|
(lib.mkIf (cfg.launchers.forUsers != null) {
|
||||||
users.users = lib.genAttrs cfg.launchers.forUsers (_: {
|
users.users = lib.genAttrs cfg.launchers.forUsers (_: {
|
||||||
packages = launcherPkgs ++ steamExtraPkgs ++ cfg.launchers.extraPackages;
|
packages = launcherSet;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user