From 4701080f285a04c6ed87b44e8ccb2f4df4625b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Fri, 9 Jan 2026 12:36:13 +0100 Subject: [PATCH] fatteh: enable cuda --- systems/fatteh/configuration.nix | 1 + systems/fatteh/cuda.nix | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 systems/fatteh/cuda.nix diff --git a/systems/fatteh/configuration.nix b/systems/fatteh/configuration.nix index bbf2bf2..3290e4a 100644 --- a/systems/fatteh/configuration.nix +++ b/systems/fatteh/configuration.nix @@ -5,6 +5,7 @@ }: { imports = [ + ./cuda.nix ./hardware-configuration.nix ../../configs/networkmanager.nix ../../configs/default.nix diff --git a/systems/fatteh/cuda.nix b/systems/fatteh/cuda.nix new file mode 100644 index 0000000..359c1c4 --- /dev/null +++ b/systems/fatteh/cuda.nix @@ -0,0 +1,42 @@ +{ + nixpkgs.config = { + allowUnfree = true; + }; + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware.nvidia = { + modesetting.enable = true; # needed for PRIME + open = false; # MX150 (Pascal) needs proprietary firmware + nvidiaSettings = true; + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + # from lspci + intelBusId = "PCI:0:2:0"; # Intel UHD Graphics 620 + nvidiaBusId = "PCI:1:0:0"; # NVIDIA GeForce MX150 + }; + }; + + nix.settings.system-features = [ "cuda" ]; + + programs.nix-required-mounts = { + enable = true; + presets.nvidia-gpu.enable = true; + # Workaround for , copied from + # . + extraWrapperArgs = [ + "--run shift" + "--add-flag '${ + builtins.unsafeDiscardOutputDependency + (derivation { + name = "needs-cuda"; + builder = "_"; + system = "_"; + requiredSystemFeatures = [ "cuda" ]; + }).drvPath + }'" + ]; + }; +}