diff options
| author | Seth Flynn <[email protected]> | 2025-02-13 21:15:51 -0500 |
|---|---|---|
| committer | Seth Flynn <[email protected]> | 2025-02-13 22:09:11 -0500 |
| commit | 5fb078416ff2f51e4a8a672673e9f38a451ac745 (patch) | |
| tree | 4d970fb649d25b6e72ac50410a66136ac9fc4e90 /modules/nixos/mixins/nvidia.nix | |
| parent | c01800e6ab06bad0eb4a585c5435a90ff1563be0 (diff) | |
nixos/nvk: init
Diffstat (limited to 'modules/nixos/mixins/nvidia.nix')
| -rw-r--r-- | modules/nixos/mixins/nvidia.nix | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/modules/nixos/mixins/nvidia.nix b/modules/nixos/mixins/nvidia.nix index e62bc90..bfa9e09 100644 --- a/modules/nixos/mixins/nvidia.nix +++ b/modules/nixos/mixins/nvidia.nix @@ -1,8 +1,6 @@ { config, lib, ... }: let - cfg = config.hardware.nvidia; - isNvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers; # Unlike Nixpkgs, I know all of my GPUs should prefer the open modules after 560 @@ -10,10 +8,6 @@ let in { - options.hardware.nvidia = { - nvk.enable = lib.mkEnableOption "an NVK specialisation"; - }; - config = lib.mkMerge [ { hardware.nvidia = { @@ -23,41 +17,20 @@ in }; } + (lib.mkIf config.virtualisation.podman.enable { + hardware = { + nvidia-container-toolkit.enable = true; + }; + }) + (lib.mkIf (isNvidiaEnabled && !config.hardware.nvidia.open) { # Don't use GSP Firmware on proprietary driver + + # TODO: Remove when the following is fixed # https://github.com/NVIDIA/open-gpu-kernel-modules/issues/693 boot.kernelParams = [ "nvidia.NVreg_EnableGpuFirmware=0" ]; }) - - (lib.mkIf cfg.nvk.enable { - specialisation = { - nvk.configuration = { - boot = { - # required for GSP firmware - kernelParams = [ "nouveau.config=NvGspRm=1" ]; - # we want early KMS - # https://wiki.archlinux.org/title/Kernel_mode_setting#Early_KMS_start - initrd.kernelModules = [ "nouveau" ]; - }; - - hardware = { - graphics.extraPackages = lib.mkForce [ ]; - nvidia-container-toolkit.enable = lib.mkForce false; - }; - - services.xserver.videoDrivers = lib.mkForce [ "modesetting" ]; - - system.nixos.tags = [ "with-nvk" ]; - }; - }; - }) - - (lib.mkIf config.virtualisation.podman.enable { - hardware = { - nvidia-container-toolkit.enable = true; - }; - }) ]; } |
