diff --git a/home/default.nix b/home/default.nix index c48f05e..0c65a94 100644 --- a/home/default.nix +++ b/home/default.nix @@ -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; diff --git a/home/package-sets/communication.nix b/home/package-sets/communication.nix index 6dceaf1..cafbbf7 100644 --- a/home/package-sets/communication.nix +++ b/home/package-sets/communication.nix @@ -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 = { diff --git a/home/package-sets/productivity.nix b/home/package-sets/productivity.nix index 7710dac..549f885 100644 --- a/home/package-sets/productivity.nix +++ b/home/package-sets/productivity.nix @@ -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"; diff --git a/hosts/nullbox/configuration.nix b/hosts/nullbox/configuration.nix index 1e01ab7..c1b1527 100644 --- a/hosts/nullbox/configuration.nix +++ b/hosts/nullbox/configuration.nix @@ -54,6 +54,7 @@ nixfiles = { profile.pc.enable = true; programs.adb.enable = true; + workarounds.nvidiaPrimary = true; programs.greetd = { preset = "tuigreet"; settings = { diff --git a/system/default.nix b/system/default.nix index 15d8998..38621eb 100644 --- a/system/default.nix +++ b/system/default.nix @@ -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; };