aboutsummaryrefslogtreecommitdiff
path: root/modules/teh-nix/nvidia.nix
diff options
context:
space:
mode:
authorDylan <boss@tehbox.org>2026-10-17 21:53:43 +1300
committerDylan <boss@tehbox.org>2026-10-17 21:53:43 +1300
commit280e1bbe5e733128a451260685cc8ecd10a042a3 (patch)
tree78bab82353bbfa00f9a781015e246c274a5c983b /modules/teh-nix/nvidia.nix
parentbcfc69e424802276cc52fb6e00fb4a42e9c37816 (diff)
downloadnixos-configuration-280e1bbe5e733128a451260685cc8ecd10a042a3.tar.gz
nixos-configuration-280e1bbe5e733128a451260685cc8ecd10a042a3.zip
feat: Dendritic pattern
This re-write was done with the help of claude, and still needs a decent amount of changes before it properly follows the dendritic pattern
Diffstat (limited to 'modules/teh-nix/nvidia.nix')
-rw-r--r--modules/teh-nix/nvidia.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/modules/teh-nix/nvidia.nix b/modules/teh-nix/nvidia.nix
new file mode 100644
index 0000000..f14d20c
--- /dev/null
+++ b/modules/teh-nix/nvidia.nix
@@ -0,0 +1,40 @@
+{ ... }:
+{
+ flake.modules.nixos.teh-nix =
+ { config, pkgs, lib, ... }:
+ let
+ nvidia-offload = pkgs.writeShellScriptBin "prime-run" ''
+export __NV_PRIME_RENDER_OFFLOAD=1
+export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
+export __GLX_VENDOR_LIBRARY_NAME=nvidia
+export __VK_LAYER_NV_optimus=NVIDIA_only
+exec "$@"
+'';
+ in
+ {
+ options.teh-nix.nvidia = with lib; {
+ enable = mkEnableOption "Enable nvidia";
+ };
+
+ config = lib.mkIf config.teh-nix.nvidia.enable {
+ nixpkgs.config.allowUnfree = true;
+ hardware.graphics.enable = true;
+ hardware.nvidia.modesetting.enable = true;
+ # hardware.nvidia.dynamicBoost.enable = true;
+ hardware.nvidia.open = true;
+ hardware.nvidia.prime = {
+ # sync.enable = true;
+ offload.enable = true;
+ # offload.offloadCmdMainProgram = "prime-run";
+
+ nvidiaBusId = "PCI:1:0:0";
+ intelBusId = "PCI:5:0:0";
+ };
+ hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
+
+ services.xserver.videoDrivers = [ "nvidia" ];
+
+ environment.systemPackages = [ nvidia-offload ];
+ };
+ };
+}