mirror of
https://github.com/Ascyii/nixos.git
synced 2026-01-01 14:54:26 -05:00
43 lines
1.0 KiB
Nix
43 lines
1.0 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
let inherit (lib) mkOption types;
|
|
in {
|
|
options = {
|
|
enableCuda = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable CUDA support for Blender and other packages.
|
|
Warning: This can cause very long build times.
|
|
'';
|
|
};
|
|
nvidiaOpen = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
hardware.graphics.enable = true;
|
|
|
|
services.xserver.videoDrivers = [ "nvidia" ];
|
|
|
|
hardware.nvidia = {
|
|
modesetting.enable = true;
|
|
powerManagement.enable = false;
|
|
open = config.nvidiaOpen;
|
|
nvidiaSettings = true;
|
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
};
|
|
|
|
# Apply CUDA-specific settings if enabled
|
|
nixpkgs.config.cudaSupport = config.enableCuda;
|
|
hardware.enableAllFirmware = config.enableCuda;
|
|
|
|
environment.systemPackages = (if config.enableCuda then
|
|
[ (pkgs.blender.override { cudaSupport = true; }) ]
|
|
else
|
|
[ ]);
|
|
};
|
|
}
|