Add NixVirt support and GPU passthrough configuration
This commit is contained in:
@@ -1,61 +1,99 @@
|
||||
# Monitor layout for 14900k (ported from NixOS-New `hosts/clients/14900k/home.nix`).
|
||||
# Niri: `chiasson.desktop.niri.extraSettings` (`extraConfig` KDL + `binds` merged with defaults).
|
||||
# Monitor layout for 14900k.
|
||||
# NVIDIA (default): DP-2 ultrawide, HDMI-A-3 + DP-4 side/top stack.
|
||||
# Intel iGPU (gpu passthru): DP-1 ultrawide, HDMI-A-2 Samsung to the left.
|
||||
# Niri: `extraSettings` (KDL via `extraConfig`, other wrapper-modules keys) + `extraBinds` (merged keybinds).
|
||||
# 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.
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
chiasson.desktop.niri.extraSettings = {
|
||||
extraConfig = ''
|
||||
output "DP-2" {
|
||||
mode "2560x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=0
|
||||
focus-at-startup
|
||||
}
|
||||
output "HDMI-A-3" {
|
||||
mode "1920x1080@60"
|
||||
scale 1.0
|
||||
position x=-1920 y=0
|
||||
}
|
||||
output "DP-4" {
|
||||
mode "1920x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=-1080
|
||||
}
|
||||
let
|
||||
gpuPassthru = config.chiasson.system.gpuPassthru.enable;
|
||||
|
||||
'';
|
||||
niriOutputs =
|
||||
if gpuPassthru then
|
||||
''
|
||||
output "DP-1" {
|
||||
mode "2560x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=0
|
||||
focus-at-startup
|
||||
}
|
||||
output "HDMI-A-2" {
|
||||
mode "1920x1080@60"
|
||||
scale 1.0
|
||||
position x=-1920 y=0
|
||||
}
|
||||
''
|
||||
else
|
||||
''
|
||||
output "DP-3" {
|
||||
mode "2560x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=0
|
||||
focus-at-startup
|
||||
}
|
||||
output "HDMI-A-3" {
|
||||
mode "1920x1080@60"
|
||||
scale 1.0
|
||||
position x=-1920 y=0
|
||||
}
|
||||
output "DP-4" {
|
||||
mode "1920x1080@144"
|
||||
scale 1.0
|
||||
position x=0 y=-1080
|
||||
}
|
||||
'';
|
||||
|
||||
binds."XF86Tools".spawn = [
|
||||
"wpctl"
|
||||
"set-mute"
|
||||
"@DEFAULT_AUDIO_SOURCE@"
|
||||
"toggle"
|
||||
];
|
||||
};
|
||||
|
||||
chiasson.desktop.hyprland.settings = lib.mkIf config.chiasson.desktop.hyprland.enable (
|
||||
let
|
||||
monitorList = [
|
||||
"DP-2, 2560x1080@144, 0x0, 1"
|
||||
hyprlandMonitors =
|
||||
if gpuPassthru then
|
||||
[
|
||||
"DP-1, 2560x1080@144, 0x0, 1"
|
||||
"HDMI-A-2, 1920x1080@60, -1920x0, 1"
|
||||
]
|
||||
else
|
||||
[
|
||||
"DP-3, 2560x1080@144, 0x0, 1"
|
||||
"DP-4, 1920x1080@144, 0x-1080, 1"
|
||||
"HDMI-A-3, 1920x1080@60, -1920x0, 1"
|
||||
];
|
||||
workspaceList = [
|
||||
|
||||
hyprlandWorkspaces =
|
||||
if gpuPassthru then
|
||||
[
|
||||
"1, monitor:DP-1, default:true"
|
||||
"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
|
||||
[
|
||||
"1, monitor:DP-3, default:true"
|
||||
"2, monitor:DP-3"
|
||||
"3, monitor:DP-3"
|
||||
"4, monitor:Unknown-2, default:true"
|
||||
"5, monitor:Unknown-2"
|
||||
"6, monitor:Unknown-2"
|
||||
"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
|
||||
{
|
||||
monitor = lib.mkBefore monitorList;
|
||||
workspace = workspaceList;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
chiasson.desktop.niri.extraSettings = {
|
||||
extraConfig = niriOutputs;
|
||||
};
|
||||
|
||||
chiasson.desktop.niri.extraBinds."XF86Tools".spawn = [
|
||||
"wpctl"
|
||||
"set-mute"
|
||||
"@DEFAULT_AUDIO_SOURCE@"
|
||||
"toggle"
|
||||
];
|
||||
|
||||
chiasson.desktop.hyprland.settings = lib.mkIf config.chiasson.desktop.hyprland.enable {
|
||||
monitor = lib.mkBefore hyprlandMonitors;
|
||||
workspace = hyprlandWorkspaces;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user