2024-05-07 23:31:41 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
2024-04-10 16:51:28 +02:00
|
|
|
let
|
2024-03-24 16:59:47 +01:00
|
|
|
cfg = config.grimmShared;
|
2024-05-07 23:31:41 +02:00
|
|
|
screen =
|
|
|
|
with lib;
|
|
|
|
types.submodule {
|
|
|
|
options = {
|
|
|
|
fps = mkOption {
|
|
|
|
type = types.either types.int (types.nonEmptyListOf types.int);
|
|
|
|
default = 60;
|
|
|
|
description = "max framerate of screen";
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
mode = mkOption {
|
|
|
|
type = types.nonEmptyStr;
|
|
|
|
default = "1920x1080";
|
|
|
|
description = "pixel format of the screen";
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
id = mkOption {
|
|
|
|
type = types.nonEmptyStr;
|
|
|
|
description = "ID of the screen";
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
pos = mkOption {
|
|
|
|
type = types.nullOr types.nonEmptyStr;
|
|
|
|
default = null;
|
|
|
|
example = "0,0";
|
|
|
|
description = "position where to place the screen";
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
};
|
|
|
|
};
|
2024-04-10 16:51:28 +02:00
|
|
|
in
|
|
|
|
{
|
2024-05-07 23:31:41 +02:00
|
|
|
config =
|
|
|
|
with cfg;
|
|
|
|
lib.mkIf (enable && graphical) {
|
|
|
|
# Enable OpenGL
|
|
|
|
hardware.opengl = {
|
|
|
|
enable = true;
|
|
|
|
driSupport = true;
|
|
|
|
driSupport32Bit = true;
|
|
|
|
extraPackages = with pkgs; [ ];
|
|
|
|
};
|
2024-04-10 16:51:28 +02:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
chaotic.mesa-git.enable = true;
|
|
|
|
boot.kernelParams = [ "nouveau.config=NvGspRm=1" ];
|
2024-03-24 16:59:47 +01:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
environment.sessionVariables = {
|
|
|
|
__GL_LOG_MAX_ANISO = "0";
|
|
|
|
__GL_SHADER_DISK_CACHE = "1";
|
|
|
|
__GL_SYNC_TO_VBLANK = "0";
|
|
|
|
__GL_THREADED_OPTIMIZATIONS = "1";
|
|
|
|
__GL_VRR_ALLOWED = "1";
|
|
|
|
# MESA_LOADER_DRIVER_OVERRIDE="zink";
|
|
|
|
# FLATPAK_GL_DRIVERS="mesa-git";
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
|
2024-05-07 23:31:41 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
glfw
|
|
|
|
glxinfo
|
|
|
|
vulkan-tools
|
|
|
|
mangohud
|
|
|
|
];
|
|
|
|
};
|
2024-04-16 12:09:17 +02:00
|
|
|
|
|
|
|
options.grimmShared = with lib; {
|
|
|
|
graphical = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = cfg.screens != { };
|
|
|
|
description = "whether to force enable graphical components";
|
|
|
|
};
|
|
|
|
|
|
|
|
screens = mkOption {
|
|
|
|
type = types.attrsOf screen;
|
|
|
|
default = { };
|
|
|
|
description = "Screens to initialize, will activate graphical components";
|
|
|
|
};
|
|
|
|
};
|
2024-03-24 16:59:47 +01:00
|
|
|
}
|