From d62d538562a98972efc5299e817b9577c29268ed Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 27 Sep 2024 13:09:45 -0600 Subject: [PATCH] [NixOS] Put nvidia configuration into a file --- nixos/base.nix | 2 -- nixos/configuration.nix | 1 + nixos/machines/ryzen-shine.nix | 1 + nixos/nvidia.nix | 16 ++++++++++++++++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 nixos/nvidia.nix diff --git a/nixos/base.nix b/nixos/base.nix index cf03ef72..e90c0cbd 100644 --- a/nixos/base.nix +++ b/nixos/base.nix @@ -59,8 +59,6 @@ makeEnable config "myModules.base" true { services.locate.enable = true; virtualisation.docker.enable = true; - hardware.nvidia-container-toolkit.enable = true; - hardware.nvidia.open = false; hardware.keyboard.zsa.enable = true; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index c2f81919..c398d017 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -23,6 +23,7 @@ ./keybase.nix ./nix.nix ./nixified.ai.nix + ./nvidia.nix ./options.nix ./plasma.nix ./postgres.nix diff --git a/nixos/machines/ryzen-shine.nix b/nixos/machines/ryzen-shine.nix index 7799fe99..b3bb501b 100644 --- a/nixos/machines/ryzen-shine.nix +++ b/nixos/machines/ryzen-shine.nix @@ -6,6 +6,7 @@ ]; features.full.enable = true; + myModules.nvidia.enable = true; # Needed for now because monitors have different refresh rates myModules.xmonad.picom.vSync.enable = false; myModules.cache-server = { diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix new file mode 100644 index 00000000..3f14b8af --- /dev/null +++ b/nixos/nvidia.nix @@ -0,0 +1,16 @@ +{ config, pkgs, makeEnable, ... }: + +makeEnable config "myModules.nvidia" false { + environment.systemPackages = with pkgs; [ + nvidia-container-toolkit + ]; + virtualisation.docker.enableNvidia = true; + hardware.nvidia-container-toolkit.enable = true; + hardware.nvidia.open = false; + hardware.graphics.extraPackages = [ pkgs.linuxPackages.nvidia_x11.out ]; + hardware.graphics.extraPackages32 = [ pkgs.linuxPackages.nvidia_x11.lib32 ]; + hardware.graphics.enable32Bit = true; + services.xserver = { + videoDrivers = [ "nvidia" ]; + }; +}