2024-12-28 17:04:36 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.settings.hardware.nvidia;
|
|
|
|
in {
|
|
|
|
options = {
|
2025-01-02 09:35:55 +01:00
|
|
|
settings.hardware.nvidia.enable = lib.mkOption {
|
2024-12-28 17:04:36 +01:00
|
|
|
type = lib.types.bool;
|
|
|
|
description = ''
|
|
|
|
Enable nvidia drivers
|
|
|
|
'';
|
|
|
|
};
|
2024-03-12 21:24:29 +01:00
|
|
|
};
|
|
|
|
|
2024-12-28 17:04:36 +01:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
|
|
|
|
"nvidia-x11"
|
|
|
|
"nvidia-settings"
|
|
|
|
];
|
2024-03-12 21:24:29 +01:00
|
|
|
|
2024-12-28 17:04:36 +01:00
|
|
|
hardware.graphics.enable = true;
|
2024-03-12 21:24:29 +01:00
|
|
|
|
2024-12-28 17:04:36 +01:00
|
|
|
services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc.
|
2024-03-12 21:24:29 +01:00
|
|
|
|
2024-12-28 17:04:36 +01:00
|
|
|
hardware.nvidia = {
|
|
|
|
open = true;
|
|
|
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
2024-09-12 18:43:03 +02:00
|
|
|
};
|
2024-03-12 21:24:29 +01:00
|
|
|
};
|
|
|
|
}
|