2023-07-08 20:23:36 +04:00
|
|
|
{
|
2023-08-13 20:01:42 +04:00
|
|
|
outputs,
|
|
|
|
options,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
2024-08-01 16:24:09 +04:00
|
|
|
let
|
2023-08-13 20:01:42 +04:00
|
|
|
cfg = config.modules.hardware.nvidia;
|
|
|
|
in {
|
2023-08-13 20:32:50 +04:00
|
|
|
imports = [
|
|
|
|
./prime.nix
|
|
|
|
];
|
2023-07-08 20:23:36 +04:00
|
|
|
options.modules.hardware.nvidia = {
|
2024-08-01 16:24:09 +04:00
|
|
|
enable = lib.mkEnableOption false;
|
2023-07-08 20:23:36 +04:00
|
|
|
};
|
|
|
|
|
2024-08-01 16:24:09 +04:00
|
|
|
config = lib.mkIf cfg.enable {
|
2024-08-09 17:55:44 +04:00
|
|
|
hardware.graphics = {
|
2023-07-08 20:23:36 +04:00
|
|
|
enable = true;
|
2024-08-09 17:55:44 +04:00
|
|
|
enable32Bit = true;
|
2023-08-13 20:01:42 +04:00
|
|
|
};
|
2023-07-08 20:23:36 +04:00
|
|
|
|
2023-08-13 20:01:42 +04:00
|
|
|
# regardless of if you have intel/nvidia
|
2023-07-17 18:42:23 +04:00
|
|
|
# or amd/nvidia this HAS to be nvidia only
|
|
|
|
# or else it will not work
|
2023-08-13 20:01:42 +04:00
|
|
|
services.xserver.videoDrivers = ["nvidia"];
|
2023-07-08 20:23:36 +04:00
|
|
|
|
|
|
|
hardware.nvidia = {
|
|
|
|
# wayland support
|
|
|
|
modesetting.enable = true;
|
|
|
|
|
|
|
|
# TODO(sako) add this as a cfg option
|
|
|
|
# set to true if you have an rtx or newer graphics card
|
|
|
|
# else set to false
|
|
|
|
open = false;
|
|
|
|
|
|
|
|
# settings
|
|
|
|
nvidiaSettings = true;
|
|
|
|
|
2023-08-13 20:01:42 +04:00
|
|
|
# screen tearing fix
|
2023-08-13 20:23:37 +04:00
|
|
|
# might consume more power?? dont know, shouldnt be an issue hopefully
|
2023-08-13 20:01:42 +04:00
|
|
|
forceFullCompositionPipeline = true;
|
|
|
|
|
2023-07-08 20:23:36 +04:00
|
|
|
# Package
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|