From 8b60957c58288fb833ceae26bd5214107ce96f2b Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Fri, 11 Jul 2025 18:08:19 -0400 Subject: [PATCH] monitor gen working for sway --- home/crow/Datto.nix | 5 ++ home/crow/Parzival.nix | 23 +++++++- home/crow/common/core/default.nix | 2 +- .../common/optional/desktops/sway/default.nix | 13 ++++- .../common/optional/desktops/sway/sway.conf | 9 ---- home/crow/common/optional/gaming/default.nix | 47 +++++++++++++++++ hosts/common/optional/gaming.nix | 9 ---- hosts/nixos/Datto/default.nix | 52 +++++++++++++++++++ 8 files changed, 138 insertions(+), 22 deletions(-) create mode 100644 home/crow/Datto.nix create mode 100644 home/crow/common/optional/gaming/default.nix create mode 100644 hosts/nixos/Datto/default.nix diff --git a/home/crow/Datto.nix b/home/crow/Datto.nix new file mode 100644 index 0000000..9b2069a --- /dev/null +++ b/home/crow/Datto.nix @@ -0,0 +1,5 @@ +{...}: { + imports = [ + common/core + ]; +} diff --git a/home/crow/Parzival.nix b/home/crow/Parzival.nix index 1aa5a91..a5b2264 100644 --- a/home/crow/Parzival.nix +++ b/home/crow/Parzival.nix @@ -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"; + } + ]; } diff --git a/home/crow/common/core/default.nix b/home/crow/common/core/default.nix index 69b88ea..9ac51db 100644 --- a/home/crow/common/core/default.nix +++ b/home/crow/common/core/default.nix @@ -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 diff --git a/home/crow/common/optional/desktops/sway/default.nix b/home/crow/common/optional/desktops/sway/default.nix index 4d65971..df327a5 100644 --- a/home/crow/common/optional/desktops/sway/default.nix +++ b/home/crow/common/optional/desktops/sway/default.nix @@ -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; }; } diff --git a/home/crow/common/optional/desktops/sway/sway.conf b/home/crow/common/optional/desktops/sway/sway.conf index 3e0a84b..925dce2 100644 --- a/home/crow/common/optional/desktops/sway/sway.conf +++ b/home/crow/common/optional/desktops/sway/sway.conf @@ -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 diff --git a/home/crow/common/optional/gaming/default.nix b/home/crow/common/optional/gaming/default.nix new file mode 100644 index 0000000..412ccc4 --- /dev/null +++ b/home/crow/common/optional/gaming/default.nix @@ -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 + ]; +} diff --git a/hosts/common/optional/gaming.nix b/hosts/common/optional/gaming.nix index 14756e1..60d1870 100644 --- a/hosts/common/optional/gaming.nix +++ b/hosts/common/optional/gaming.nix @@ -22,13 +22,4 @@ }; }; }; - environment.systemPackages = with pkgs; [ - vintagestory - mudlet - r2modman - prismlauncher - ]; - nixpkgs.config.permittedInsecurePackages = [ - "dotnet-runtime-7.0.20" # VintageStory dep - ]; } diff --git a/hosts/nixos/Datto/default.nix b/hosts/nixos/Datto/default.nix new file mode 100644 index 0000000..378f35d --- /dev/null +++ b/hosts/nixos/Datto/default.nix @@ -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; + }; + }; +}