monitor gen working for sway

This commit is contained in:
TheWanderingCrow 2025-07-11 18:08:19 -04:00
parent 0c25456570
commit 8b60957c58
8 changed files with 138 additions and 22 deletions

5
home/crow/Datto.nix Normal file
View file

@ -0,0 +1,5 @@
{...}: {
imports = [
common/core
];
}

View file

@ -1,4 +1,4 @@
{...}: {
{lib, ...}: {
imports = [
common/core
common/optional/desktops/sway
@ -6,4 +6,25 @@
common/optional/comms
common/optional/media
];
monitors = [
{
name = "HDMI-A-1";
width = 1920;
height = 1080;
refreshRate = 75;
transform = 270;
background = lib.custom.relativeToRoot "assets/wallpapers/desert_worm.jpg";
}
{
name = "DP-1";
primary = true;
width = 2560;
height = 1440;
refreshRate = 170;
x = 1080;
y = 215;
background = lib.custom.relativeToRoot "assets/wallpapers/barren_desert.jpg";
}
];
}

View file

@ -13,7 +13,7 @@ in {
imports = lib.flatten [
(map lib.custom.relativeToRoot [
"modules/common/host-spec.nix"
#"modules/home"
"modules/home"
])
#./${platform.nix}
./xdg.nix

View file

@ -3,7 +3,16 @@
config,
pkgs,
...
}: {
}: let
monitorConfig =
(
map (m:
if m.enabled
then "output ${m.name} mode ${toString m.width}x${toString m.height}@${toString m.refreshRate}Hz pos ${toString m.x} ${toString m.y} bg ${toString m.background} stretch"
else "output ${m.name} disable")
)
config.monitors;
in {
imports = [
./waybar.nix
../swww
@ -33,6 +42,6 @@
wayland.windowManager.sway = {
enable = true;
config = null;
extraConfig = builtins.readFile ./sway.conf;
extraConfig = builtins.readFile ./sway.conf + lib.strings.concatStringsSep "\n" monitorConfig;
};
}

View file

@ -1,12 +1,3 @@
output HDMI-A-1 mode 1920x1080@74.973Hz
output HDMI-A-1 pos 0 0
output HDMI-A-1 transform 270
output DP-1 mode 2560x1440@169.831Hz
output DP-1 pos 1080 215
# Backgrounds
# Assign specific workspaces to specific outputs
workspace 1 output HDMI-A-1 # Firefox
workspace 2 output HDMI-A-1 # Comms

View file

@ -0,0 +1,47 @@
# This module just provides a customized .desktop file with gamescope args dynamically created based on the
# host's monitors configuration
{
pkgs,
config,
lib,
...
}: let
monitor = lib.head (lib.filter (m: m.primary) config.monitors);
steam-session = let
gamescope = lib.concatStringsSep " " [
(lib.getExe pkgs.gamescope)
"--output-width ${toString monitor.width}"
"--output-height ${toString monitor.height}"
"--framerate-limit ${toString monitor.refreshRate}"
"--prefer-output ${monitor.name}"
"--adaptive-sync"
"--expose-wayland"
"--steam"
"--hdr-enabled"
];
steam = lib.concatStringsSep " " [
"steam"
#"steam://open/bigpicture"
];
in
pkgs.writeTextDir "share/applications/steam-session.desktop" ''
[Desktop Entry]
Name=Steam Session
Exec=${gamescope} -- ${steam}
Icon=steam
Type=Application
'';
in {
home.packages = [
steam-session
pkgs.vintagestory
pkgs.mudlet
pkgs.r2modman
pkgs.prismlauncher
];
nixpkgs.config.permittedInsecurePackages = [
"dotnet-runtime-7.0.20" # VintageStory dep
];
}

View file

@ -22,13 +22,4 @@
};
};
};
environment.systemPackages = with pkgs; [
vintagestory
mudlet
r2modman
prismlauncher
];
nixpkgs.config.permittedInsecurePackages = [
"dotnet-runtime-7.0.20" # VintageStory dep
];
}

View file

@ -0,0 +1,52 @@
#######################
# #
# Datto - OctoPi Node #
# #
#######################
{
inputs,
lib,
pkgs,
...
}: {
imports = lib.flatten [
# Disks
inputs.disko.nixosModules.disko
(lib.custom.relativeToRoot "hosts/common/disks/btrfs-disk.nix")
{
_module.args = {
disk = "/dev/sda";
withSwap = true;
swapSize = "8";
};
}
# Misc
(map lib.custom.relativeToRoot [
# Required configs
"hosts/common/core"
# Optional configs
])
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hostSpec = {
hostName = "Datto";
persistFolder = "/persist";
};
networking = {
networkmanager.enable = true;
enableIPv6 = false;
};
boot.loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true;
};
};
}