mirror of
https://github.com/blahai/nyx.git
synced 2025-01-19 11:30:20 +00:00
94 lines
2.1 KiB
Nix
94 lines
2.1 KiB
Nix
|
{
|
||
|
lib,
|
||
|
pkgs,
|
||
|
config,
|
||
|
...
|
||
|
}: let
|
||
|
inherit (config.olympus) device;
|
||
|
inherit
|
||
|
(lib.modules)
|
||
|
mkIf
|
||
|
mkMerge
|
||
|
mkDefault
|
||
|
;
|
||
|
inherit (lib.validators) isWayland;
|
||
|
|
||
|
isHybrid = device.gpu == "hybrid-nv";
|
||
|
in {
|
||
|
config = mkIf (device.gpu == "nvidia" || device.gpu == "hybrid-nv") {
|
||
|
# nvidia drivers kinda are unfree software
|
||
|
nixpkgs.config.allowUnfree = true;
|
||
|
|
||
|
services.xserver = mkMerge [
|
||
|
{videoDrivers = ["nvidia"];}
|
||
|
|
||
|
# xorg settings
|
||
|
];
|
||
|
|
||
|
boot = {
|
||
|
# blacklist nouveau module as otherwise it conflicts with nvidia drm
|
||
|
blacklistedKernelModules = ["nouveau"];
|
||
|
|
||
|
# Enables the Nvidia's experimental framebuffer device
|
||
|
# fix for the imaginary monitor that does not exist
|
||
|
kernelParams = ["nvidia_drm.fbdev=1"];
|
||
|
};
|
||
|
|
||
|
environment = {
|
||
|
sessionVariables = mkMerge [
|
||
|
{LIBVA_DRIVER_NAME = "nvidia";}
|
||
|
|
||
|
(mkIf (isWayland config) {
|
||
|
# GBM_BACKEND = "nvidia-drm"; # breaks firefox apparently
|
||
|
|
||
|
WLR_DRM_DEVICES = mkDefault "/dev/dri/card1";
|
||
|
})
|
||
|
];
|
||
|
|
||
|
systemPackages = builtins.attrValues {
|
||
|
inherit (pkgs.nvtopPackages) nvidia;
|
||
|
|
||
|
inherit
|
||
|
(pkgs)
|
||
|
# mesa
|
||
|
mesa
|
||
|
# vulkan
|
||
|
vulkan-tools
|
||
|
vulkan-loader
|
||
|
vulkan-validation-layers
|
||
|
vulkan-extension-layer
|
||
|
# libva
|
||
|
libva
|
||
|
libva-utils
|
||
|
;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
hardware = {
|
||
|
nvidia = {
|
||
|
package = mkDefault config.boot.kernelPackages.nvidiaPackages.beta;
|
||
|
|
||
|
prime.offload = {
|
||
|
enable = isHybrid;
|
||
|
enableOffloadCmd = isHybrid;
|
||
|
};
|
||
|
|
||
|
powerManagement = {
|
||
|
enable = mkDefault true;
|
||
|
finegrained = mkDefault false;
|
||
|
};
|
||
|
|
||
|
open = false; # dont use the open drivers by default
|
||
|
nvidiaSettings = false; # adds nvidia-settings to pkgs, so useless on nixos
|
||
|
nvidiaPersistenced = true;
|
||
|
# forceFullCompositionPipeline = true;
|
||
|
};
|
||
|
|
||
|
graphics = {
|
||
|
extraPackages = [pkgs.nvidia-vaapi-driver];
|
||
|
extraPackages32 = [pkgs.pkgsi686Linux.nvidia-vaapi-driver];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|