nix/modules/system/hardware/nvidia.nix
2025-01-02 09:35:55 +01:00

33 lines
652 B
Nix

{ config, lib, ... }:
with lib;
let
cfg = config.settings.hardware.nvidia;
in {
options = {
settings.hardware.nvidia.enable = lib.mkOption {
type = lib.types.bool;
description = ''
Enable nvidia drivers
'';
};
};
config = mkIf cfg.enable {
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"nvidia-x11"
"nvidia-settings"
];
hardware.graphics.enable = true;
services.xserver.videoDrivers = ["nvidia"]; # or "nvidiaLegacy470 etc.
hardware.nvidia = {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
};
}