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 | |
| parent | c01800e6ab06bad0eb4a585c5435a90ff1563be0 (diff) | |
nixos/nvk: init
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/nixos/custom/default.nix | 1 | ||||
| -rw-r--r-- | modules/nixos/custom/nvk.nix | 34 | ||||
| -rw-r--r-- | modules/nixos/mixins/nvidia.nix | 43 |
3 files changed, 43 insertions, 35 deletions
diff --git a/modules/nixos/custom/default.nix b/modules/nixos/custom/default.nix index db24a63..8b9df32 100644 --- a/modules/nixos/custom/default.nix +++ b/modules/nixos/custom/default.nix @@ -3,6 +3,7 @@ ./determinate.nix ./github-mirror ./nvd-diff.nix + ./nvk.nix ./remote-builders.nix ]; } diff --git a/modules/nixos/custom/nvk.nix b/modules/nixos/custom/nvk.nix new file mode 100644 index 0000000..2178e63 --- /dev/null +++ b/modules/nixos/custom/nvk.nix @@ -0,0 +1,34 @@ +{ config, lib, ... }: + +let + cfg = config.borealis.nvk; +in + +{ + options.borealis.nvk = { + enable = lib.mkEnableOption "an NVK specialisation"; + }; + + config = lib.mkIf cfg.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" ]; + }; + }; + }; +} 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; - }; - }) ]; } |
