- Updates import paths in flake to correct locations - Rename lib file correctly
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ lib, ... }:
|
|
rec {
|
|
# Helper to convert Nix attrs to gamescope command-line arguments
|
|
toCliArgs =
|
|
attrs:
|
|
let
|
|
argToString =
|
|
name: value:
|
|
if builtins.isBool value then
|
|
lib.optionalString value "--${name}"
|
|
else
|
|
"--${name} ${toString value}";
|
|
in
|
|
lib.concatStringsSep " " (lib.mapAttrsToList argToString attrs);
|
|
|
|
# Helper to convert Nix attrs to fish 'set -x' commands
|
|
toEnvCommands =
|
|
attrs:
|
|
lib.concatStringsSep "\n" (
|
|
lib.mapAttrsToList (name: value: "set -x ${name} '${toString value}'") attrs
|
|
);
|
|
|
|
getPrimaryMonitor = monitors: lib.findFirst (m: m.primary) null monitors;
|
|
|
|
getMonitorDefaults =
|
|
monitors:
|
|
let
|
|
getPrimary = getPrimaryMonitor monitors;
|
|
in
|
|
{
|
|
WIDTH = if getPrimary != null then getPrimary.width else 1920;
|
|
HEIGHT = if getPrimary != null then getPrimary.height else 1080;
|
|
REFRESH_RATE = if getPrimary != null then getPrimary.refreshRate else 60;
|
|
VRR = if getPrimary != null then getPrimary.vrr else false;
|
|
HDR = if getPrimary != null then getPrimary.hdr else false;
|
|
};
|
|
}
|