Make NVIDIA wayland workarounds configurable

This commit is contained in:
NullBite 2024-05-13 21:04:14 -04:00
parent d15612b6bd
commit 293152df13
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
5 changed files with 23 additions and 2 deletions

View File

@ -59,6 +59,14 @@ in
default = (lib.hasAttrByPath [ "nixfiles" "meta" "wayland" ] osConfig) && osConfig.nixfiles.meta.wayland;
example = true;
};
workarounds.nvidiaPrimary = lib.mkOption {
description = "Whether to enable workarounds for NVIDIA as the primary GPU";
default = osConfig.nixfiles.workarounds.nvidiaPrimary or false;
example = true;
type = lib.types.bool;
};
path = lib.mkOption {
description = "The absolute path of the nixfiles flake";
type = lib.types.str;

View File

@ -6,7 +6,9 @@ let
else
pkgs.rustdesk-flutter;
vesktop-ozone-cmd = "env NIXOS_OZONE_WL=1 vesktop --disable-gpu";
vesktop-ozone-cmd = let
extraFlags = lib.optionalString config.nixfiles.workarounds.nvidiaPrimary " --disable-gpu";
in "env NIXOS_OZONE_WL=1 vesktop${extraFlags}";
in
{
options.nixfiles.packageSets.communication = {

View File

@ -15,7 +15,10 @@ in
xdg.desktopEntries.obsidian = lib.mkIf config.nixfiles.meta.graphical {
categories = [ "Office" ];
comment = "Knowledge base";
exec = "env NIXOS_OZONE_WL=1 obsidian --disable-gpu %u";
exec = let
extraFlags = with lib.strings;
optionalString config.nixfiles.workarounds.nvidiaPrimary " --disable-gpu";
in "env NIXOS_OZONE_WL=1 obsidian${extraFlags} %u";
icon = "obsidian";
mimeType = [ "x-scheme-handler/obsidian" ];
name = "Obsidian";

View File

@ -54,6 +54,7 @@
nixfiles = {
profile.pc.enable = true;
programs.adb.enable = true;
workarounds.nvidiaPrimary = true;
programs.greetd = {
preset = "tuigreet";
settings = {

View File

@ -28,6 +28,13 @@ in
type = lib.types.bool;
};
workarounds.nvidiaPrimary = lib.mkOption {
description = "Whether to enable workarounds for NVIDIA as the primary GPU";
default = false;
example = true;
type = lib.types.bool;
};
lib = lib.mkOption {
description = "nixfiles library";
default = (import ../lib/nixfiles) { inherit pkgs; };