From 1e6daa09f67fa25b9f3e81373cc1f7cac4806828 Mon Sep 17 00:00:00 2001 From: Andreas Schaafsma Date: Sun, 30 Nov 2025 00:32:11 +0100 Subject: [PATCH] updates --- flake.lock | 74 ++++---- modules/nixos/cosmic-desktop/default.nix | 32 ---- .../graphics-amd-igpu-only/default.nix | 57 ------ .../default.nix | 176 ------------------ .../graphics-nvidia-prime-amd/default.nix | 170 ----------------- .../default.nix | 151 --------------- .../drivebystation-nix/configuration.nix | 20 ++ .../drivebystation-nix/default.nix | 3 +- .../hardware/acer-monitor-edid.nix | 2 +- .../hardware/graphics/intel_nvidia.nix | 126 ++++++------- .../hardware/graphics/nvidia-stable.nix | 2 +- .../hardware/graphics/nvidia.nix | 82 +++----- .../hardware/hardware-configuration.nix | 11 +- .../x86_64-linux/drivebystation-nix/video.nix | 2 +- 14 files changed, 143 insertions(+), 765 deletions(-) delete mode 100644 modules/nixos/cosmic-desktop/default.nix delete mode 100644 modules/nixos/hardware/graphics-amd-igpu-only/default.nix delete mode 100644 modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix delete mode 100644 modules/nixos/hardware/graphics-nvidia-prime-amd/default.nix delete mode 100644 modules/nixos/hardware/graphics-nvidia-specializations/default.nix diff --git a/flake.lock b/flake.lock index 23a78e9..0fe6518 100644 --- a/flake.lock +++ b/flake.lock @@ -50,11 +50,11 @@ "flake-compat_3": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -184,11 +184,11 @@ ] }, "locked": { - "lastModified": 1749160002, - "narHash": "sha256-IM3xKjsKxhu7Y1WdgTltrLKiOJS8nW7D4SUDEMNr7CI=", + "lastModified": 1752467539, + "narHash": "sha256-4kaR+xmng9YPASckfvIgl5flF/1nAZOplM+Wp9I5SMI=", "owner": "nix-community", "repo": "home-manager", - "rev": "68cc9eeb3875ae9682c04629f20738e1e79d72aa", + "rev": "1e54837569e0b80797c47be4720fab19e0db1616", "type": "github" }, "original": { @@ -226,11 +226,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1745057346, - "narHash": "sha256-71cyYKUul9owRzbcObXkzhTBcmnXJsvmk1gq0RbP5PQ=", + "lastModified": 1751809810, + "narHash": "sha256-DNI/IxfFRNDrGPdpwsEsmXCYFeKdRDRKDLcDimZWrVE=", "owner": "taj-ny", "repo": "kwin-effects-forceblur", - "rev": "fea9f80f27389aa8a62befb5babf40b28fed328d", + "rev": "26ea1b6830143b15dba114fce754f6253e9eb5a5", "type": "github" }, "original": { @@ -273,11 +273,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1749121763, - "narHash": "sha256-TVFiyMBs+3KEzZVwf/n1zedUWzPrMPzud/2Jiho8dcE=", + "lastModified": 1751591814, + "narHash": "sha256-A4lgvuj4v+Pr8MniXz1FBG0DXOygi8tTECR+j53FMhM=", "owner": "lilyinstarlight", "repo": "nixos-cosmic", - "rev": "c89df80b72b4e1802fd91a35f4857868c953c1c0", + "rev": "fef2d0c78c4e4d6c600a88795af193131ff51bdc", "type": "github" }, "original": { @@ -292,11 +292,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1746453552, - "narHash": "sha256-r66UGha+7KVHkI7ksrcMjnw/mm9Sg4l5bQlylxHwdGU=", + "lastModified": 1752199438, + "narHash": "sha256-xSBMmGtq8K4Qv80TMqREmESCAsRLJRHAbFH2T/2Bf1Y=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "be618645aa0adf461f778500172b6896d5ab2d01", + "rev": "d34d9412556d3a896e294534ccd25f53b6822e80", "type": "github" }, "original": { @@ -340,11 +340,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1748995628, - "narHash": "sha256-bFufQGSAEYQgjtc4wMrobS5HWN0hDP+ZX+zthYcml9U=", + "lastModified": 1751048012, + "narHash": "sha256-MYbotu4UjWpTsq01wglhN5xDRfZYLFtNk7SBY0BcjkU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8eb3b6a2366a7095939cd22f0dc0e9991313294b", + "rev": "a684c58d46ebbede49f280b653b9e56100aa3877", "type": "github" }, "original": { @@ -356,11 +356,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1748929857, - "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", + "lastModified": 1751011381, + "narHash": "sha256-krGXKxvkBhnrSC/kGBmg5MyupUUT5R6IBCLEzx9jhMM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", + "rev": "30e2e2857ba47844aa71991daa6ed1fc678bcbb7", "type": "github" }, "original": { @@ -372,27 +372,27 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1742937945, - "narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=", + "lastModified": 1751792365, + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7", + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_4": { "locked": { - "lastModified": 1748929857, - "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", + "lastModified": 1752480373, + "narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", + "rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08", "type": "github" }, "original": { @@ -490,11 +490,11 @@ ] }, "locked": { - "lastModified": 1749091064, - "narHash": "sha256-TGtYjzRX0sueFhwYsnNNFF5TTKnpnloznpIghLzxeXo=", + "lastModified": 1751251399, + "narHash": "sha256-y+viCuy/eKKpkX1K2gDvXIJI/yzvy6zA3HObapz9XZ0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "12419593ce78f2e8e1e89a373c6515885e218acb", + "rev": "b22d5ee8c60ed1291521f2dde48784edd6bf695b", "type": "github" }, "original": { @@ -532,11 +532,11 @@ ] }, "locked": { - "lastModified": 1747603214, - "narHash": "sha256-lAblXm0VwifYCJ/ILPXJwlz0qNY07DDYdLD+9H+Wc8o=", + "lastModified": 1752544651, + "narHash": "sha256-GllP7cmQu7zLZTs9z0J2gIL42IZHa9CBEXwBY9szT0U=", "owner": "mic92", "repo": "sops-nix", - "rev": "8d215e1c981be3aa37e47aeabd4e61bb069548fd", + "rev": "2c8def626f54708a9c38a5861866660395bb3461", "type": "github" }, "original": { @@ -632,11 +632,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1749093358, - "narHash": "sha256-Clx1BzHsSSzIXbnCW9KM3m5gW3SFgemcW9/4XH4epeM=", + "lastModified": 1752557104, + "narHash": "sha256-nPHrsq0vSh0+BqV2xAAVsfoVqzP9KYG7Zicc6oA0nfk=", "owner": "0xc000022070", "repo": "zen-browser-flake", - "rev": "d4cf0ac2e860be17036a376ae99b233a115826bc", + "rev": "dca4ebb877124f9f3d797da30cb19f8b958ef7f5", "type": "github" }, "original": { diff --git a/modules/nixos/cosmic-desktop/default.nix b/modules/nixos/cosmic-desktop/default.nix deleted file mode 100644 index 1b918a8..0000000 --- a/modules/nixos/cosmic-desktop/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ config -, lib -, inputs -, pkgs -, ... -}: -let - inherit (lib) mkEnableOption mkIf; - inherit (lib.my-namespace) disabled enabled; - - cfg = config.my-namespace.cosmic-desktop; - # moduleImports = { - # "enabled" = [inputs.nixos-cosmic.nixosModules.default]; - # "disabled" = []; - # }; - # optionalImports = { imports = []; }; -in -{ - options.my-namespace.cosmic-desktop = { - enable = mkEnableOption "Enable cosmic"; - }; - imports = [ inputs.nixos-cosmic.nixosModules.default ]; - config = mkIf cfg.enable { - nix.settings = { - substituters = [ "https://cosmic.cachix.org/" ]; - trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ]; - }; - - services.desktopManager.cosmic.enable = true; - services.displayManager.cosmic-greeter.enable = true; - }; -} diff --git a/modules/nixos/hardware/graphics-amd-igpu-only/default.nix b/modules/nixos/hardware/graphics-amd-igpu-only/default.nix deleted file mode 100644 index 933f1de..0000000 --- a/modules/nixos/hardware/graphics-amd-igpu-only/default.nix +++ /dev/null @@ -1,57 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: -let - inherit (lib) mkEnableOption mkIf; - inherit (lib.my-namespace) disabled enabled; - - cfg = config.my-namespace.hardware.graphics-amd-igpu-only; -in -{ - options.my-namespace.hardware.graphics-amd-igpu-only = { - enable = mkEnableOption "Enable nvidia"; - }; - config = mkIf cfg.enable { - - # Enable NVIDIA driver for X11 and Wayland - # without modesetting, x server will be run by nvidia - services.xserver.videoDrivers = [ - "amdgpu" - ]; - - # Enable OpenGL - hardware.graphics = { - enable = true; - # extraPackages = with pkgs; [ nvidia-vaapi-driver ]; - }; - - hardware.graphics.enable32Bit = true; # For 32 bit applications - - boot.loader.systemd-boot.consoleMode = "max"; - - # Enable required Kernel Modules - boot.initrd.kernelModules = [ - "amdgpu" - ]; - - - boot.kernelParams = [ - "amdgpu.modeset=1" - "amd_iommu=on" - ]; - - - # Blacklist intel and nouveau - boot.blacklistedKernelModules = [ - "nouveau" - ]; - - # Modesetting is required. - # Add user to extra groups - users.users.andreas = { - extraGroups = [ "video" "render" ]; - }; - }; -} diff --git a/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix b/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix deleted file mode 100644 index 67f77d2..0000000 --- a/modules/nixos/hardware/graphics-nvidia-prime-amd-testing/default.nix +++ /dev/null @@ -1,176 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: -let - inherit (lib) mkEnableOption mkIf; - inherit (lib.my-namespace) disabled enabled; - - cfg = config.my-namespace.hardware.graphics-nvidia-prime-amd-testing; -in -{ - options.my-namespace.hardware.graphics-nvidia-prime-amd-testing = { - enable = mkEnableOption "Enable nvidia"; - }; - config = mkIf cfg.enable { - - # Enable NVIDIA driver for X11 and Wayland - # without modesetting, x server will be run by nvidia - services.xserver.videoDrivers = [ - "nvidia" - # "nvidia-drm" - # "nvidia-uvm" - # "nvidia-modeset" - # "nvidiafb" - "amdgpu" - # "modesetting" - ]; - - # Enable OpenGL - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ nvidia-vaapi-driver ]; - }; - - hardware.graphics.enable32Bit = true; # For 32 bit applications - - # Enable Switcheroo - services.switcherooControl.enable = true; - - # Use Beta Driver Package - boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_beta ]; - - - - boot.loader.systemd-boot.consoleMode = "max"; - - # Enable required Kernel Modules - boot.initrd.kernelModules = [ - "nvidia" - "nvidia-drm" - "nvidia-uvm" - "nvidia-modeset" - "nvidiafb" - "amdgpu" - # # "i2c-nvidia_gpu" - ]; - - - boot.kernelParams = [ - # "amdgpu.modeset=1" - # "nvidia-drm.fbdev=1" - # "nvidia-drm.modeset=1" - # # "nvidia.NVreg_PreserveVideoMemoryAllocations=0" - "amd_iommu=on" - # "vfio-pci.ids=\"10de:2489,10de:228b\"" - # "nomodeset" - # "nvidia_drm.modeset=1" - ]; - - - # Blacklist intel and nouveau - boot.blacklistedKernelModules = [ - # "i915" - "nouveau" - # "nvidia" - # "nvidia-drm" - # "nvidia-uvm" - # "nvidiafb" - # "nvidia_drm" - # "nvidia_modeset" - ]; - - # Extra blacklist nouveau - # boot.extraModprobeConfig = '' - # blacklist nouveau - # options nouveau modeset=0 - # ''; - - # services.xserver.config = lib.mkForce '' - # Section "ServerLayout" - # Identifier "layout" - # Screen 0 "amdgpu" - # Inactive "nvidia" - # Option "AllowNVIDIAGPUScreens" - # EndSection - - # Section "Device" - # Identifier "nvidia" - # Driver "nvidia" - # BusID "PCI:01:0:0" - # EndSection - - # Section "Screen" - # Identifier "nvidia" - # Device "nvidia" - # EndSection - - # Section "Device" - # Identifier "amdgpu" - # Driver "amdgpu" - # BusID "PCI:50:0:0" - # EndSection - - # Section "Screen" - # Identifier "amdgpu" - # Device "amdgpu" - # EndSection - # ''; - - # Configure NVIDIA driver - hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = true; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.beta; - # package = config.boot.kernelPackages.nvidiaPackages.none; - # package = config.boot.kernelPackages.nvidiaPackages.production; - nvidiaPersistenced = true; - forceFullCompositionPipeline = true; - - prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - # sync.enable=true; - # reverseSync.enable = false; - # Make sure to use the correct Bus ID values for your system! - # intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:1:0:0"; - amdgpuBusId = "PCI:50:0:0"; #For AMD GPU - }; - - }; - # Add user to extra groups - users.users.andreas = { - extraGroups = [ "video" "render" ]; - }; - -}; -} diff --git a/modules/nixos/hardware/graphics-nvidia-prime-amd/default.nix b/modules/nixos/hardware/graphics-nvidia-prime-amd/default.nix deleted file mode 100644 index 81e4e57..0000000 --- a/modules/nixos/hardware/graphics-nvidia-prime-amd/default.nix +++ /dev/null @@ -1,170 +0,0 @@ -{ config -, lib -, pkgs -, ... -}: -let - inherit (lib) mkEnableOption mkIf; - inherit (lib.my-namespace) disabled enabled; - - cfg = config.my-namespace.hardware.graphics-nvidia-prime-amd; -in -{ - options.my-namespace.hardware.graphics-nvidia-prime-amd = { - enable = mkEnableOption "Enable nvidia"; - }; - config = mkIf cfg.enable { - - # Enable NVIDIA driver for X11 and Wayland - services.xserver.videoDrivers = [ "amdgpu" "nvidia" ]; - - services.xserver.displayManager.xserverArgs = [ "-config" "/opt/x11/xserver.conf" ]; - - - services.xserver.config = lib.mkAfter '' - Section "ServerLayout" - Identifier "layout" - Screen 0 "amdgpu" - Inactive "nvidia" - Option "AllowNVIDIAGPUScreens" - EndSection - - Section "Device" - Identifier "nvidia" - Driver "nvidia" - BusID "PCI:01:0:0" - EndSection - - Section "Screen" - Identifier "nvidia" - Device "nvidia" - EndSection - - Section "Device" - Identifier "amdgpu" - Driver "amdgpu" - BusID "PCI:50:0:0" - EndSection - - Section "Screen" - Identifier "amdgpu" - Device "amdgpu" - EndSection - ''; - services.switcherooControl.enable = true; - - # Enable OpenGL - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ nvidia-vaapi-driver ]; - }; - - # Use Beta Driver Package - boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; - - - - boot.loader.systemd-boot.consoleMode = "max"; - - # Enable required Kernel Modules - boot.initrd.kernelModules = [ - "nvidia-modeset" - "nvidia" - # "amdgpu" - "nvidia-drm" - # "nvidiafb" - # "nvidia-uvm" - # "i2c-nvidia_gpu" - ]; - - - boot.kernelParams = [ - # "amdgpu.modeset=1" - "nvidia-drm.fbdev=1" - "nvidia-drm.modeset=1" - # "nvidia.NVreg_PreserveVideoMemoryAllocations=0" - # "amd_iommu=on" - # "vfio-pci.ids=\"10de:2489,10de:228b\"" - # "nomodeset" - # "nvidia_drm.modeset=1" - ]; - - - # Blacklist intel and nouveau - boot.blacklistedKernelModules = [ - "i915" - "nouveau" - # "nvidia" - # "nvidia-drm" - # "nvidia-uvm" - # "nvidiafb" - # "nvidia_drm" - # "nvidia_modeset" - ]; - - # Extra blacklist nouveau - boot.extraModprobeConfig = '' - blacklist nouveau - options nouveau modeset=0 - ''; - - # Configure NVIDIA driver - hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = true; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - # package = config.boot.kernelPackages.nvidiaPackages.beta; - package = config.boot.kernelPackages.nvidiaPackages.stable; - # package = config.boot.kernelPackages.nvidiaPackages.none; - # package = config.boot.kernelPackages.nvidiaPackages.production; - - forceFullCompositionPipeline = false; - - prime = { - offload = { - enable = lib.mkForce true; - enableOffloadCmd = lib.mkForce true; - }; - - reverseSync.enable = lib.mkForce false; - sync.enable = lib.mkForce false; - # Make sure to use the correct Bus ID values for your system! - # intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:01:0:0"; - amdgpuBusId = "PCI:50:0:0"; #For AMD GPU - }; - - }; - - # Add user to extra groups - users.users.andreas = { - extraGroups = [ "video" "render" ]; - }; - - }; - -} diff --git a/modules/nixos/hardware/graphics-nvidia-specializations/default.nix b/modules/nixos/hardware/graphics-nvidia-specializations/default.nix deleted file mode 100644 index 54c00db..0000000 --- a/modules/nixos/hardware/graphics-nvidia-specializations/default.nix +++ /dev/null @@ -1,151 +0,0 @@ -{ config, lib, pkgs, modulesPath, ... }: -let - inherit (lib) mkEnableOption mkIf; - inherit (lib.my-namespace) disabled enabled; - cfg = config.my-namespace.hardware.graphics-nvidia-specializations; -in -{ - options.my-namespace.hardware.graphics-nvidia-specializations = { - enable = mkEnableOption "Enable nvidia"; - }; - options.nvidia-sync.enable = lib.mkEnableOption "Enable NVIDIA prime sync mode"; - options.nvidia-offload.enable = lib.mkEnableOption "Enable NVIDIA prime sync mode"; - - config = { - specialisation."NVIDIA-SYNC".configuration = { - system.nixos.tags = [ "with-nvidia-sync" ]; - nvidia-sync.enable = true; - }; - - specialisation."NVIDIA-OFFLOAD".configuration = { - system.nixos.tags = [ "with-nvidia-offload" ]; - nvidia-offload.enable = true; - }; - - services.xserver.videoDrivers = [ "nvidia" "amdgpu" ]; - hardware.graphics = { - extraPackages = with pkgs; [ nvidia-vaapi-driver ]; - }; - boot.kernelParams = [ - "nvidia.NVreg_PreserveVideoMemoryAllocations=1" - "nvidia-drm.fbdev=0" - "nvidia-drm.modeset=0" - "amdgpu.modeset=1" - ]; - boot.initrd.kernelModules = [ - # "amdgpu" - "nvidia" - "nvidia-drm" - "nvidia_drm" - "nvidia-uvm" - "nvidia_uvm" - # "nvidia-modeset" - # "i2c-nvidia_gpu" - ]; - - hardware.nvidia = { - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - powerManagement.enable = false; - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - # package = config.boot.kernelPackages.nvidiaPackages.beta; - package = config.boot.kernelPackages.nvidiaPackages.production; - - prime = { - amdgpuBusId = "PCI:50:0:0"; - nvidiaBusId = "PCI:1:0:0"; - } // lib.optionalAttrs config.nvidia-sync.enable { - sync.enable = false; - } // lib.optionalAttrs (config.nvidia-offload.enable) { - offload = { - enable = true; - enableOffloadCmd = true; - }; - }; - }; - services.xserver.config = lib.mkAfter '' - Section "ServerLayout" - Identifier "layout" - Screen 0 "amdgpu" - Inactive "nvidia" - Option "AllowNVIDIAGPUScreens" - Option "AllowEmptyInitialConfiguration" "True" - EndSection - - Section "Device" - Identifier "nvidia" - Driver "nvidia" - BusID "PCI:01:0:0" - Option "AllowEmptyInitialConfiguration" "True" - EndSection - - Section "Screen" - Identifier "nvidia" - Device "nvidia" - Option "AllowEmptyInitialConfiguration" "True" - EndSection - - Section "Device" - Identifier "amdgpu" - Driver "amdgpu" - BusID "PCI:50:0:0" - #Option "AllowNVIDIAGPUScreens" - #Option "AllowEmptyInitialConfiguration" "True" - EndSection - - Section "Screen" - Identifier "amdgpu" - Device "amdgpu" - #Option "AllowEmptyInitialConfiguration" "True" - EndSection - ''; - # services.xserver.config = lib.mkForce '' - # Section "ServerLayout" - # Identifier "layout" - # Screen 0 "amdgpu" - # Inactive "nvidia" - # Option "AllowNVIDIAGPUScreens" - # EndSection - - # Section "Device" - # Identifier "nvidia" - # Driver "nvidia" - # BusID "PCI:01:0:0" - # EndSection - - # Section "Screen" - # Identifier "nvidia" - # Device "nvidia" - # EndSection - - # Section "Device" - # Identifier "amdgpu" - # Driver "amdgpu" - # BusID "PCI:50:0:0" - # EndSection - - # Section "Screen" - # Identifier "amdgpu" - # Device "amdgpu" - # EndSection - # ''; - }; -} diff --git a/systems/x86_64-linux/drivebystation-nix/configuration.nix b/systems/x86_64-linux/drivebystation-nix/configuration.nix index e2e5046..418313f 100644 --- a/systems/x86_64-linux/drivebystation-nix/configuration.nix +++ b/systems/x86_64-linux/drivebystation-nix/configuration.nix @@ -161,8 +161,28 @@ gnome-tweaks qemu mpv + krita + qemu ]; + virtualisation.libvirtd = { + enable = true; + qemu = { + package = pkgs.qemu_kvm; + runAsRoot = true; + swtpm.enable = true; + ovmf = { + enable = true; + packages = [(pkgs.OVMF.override { + secureBoot = true; + tpmSupport = true; + }).fd]; + }; + }; + }; + + + systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ]; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; diff --git a/systems/x86_64-linux/drivebystation-nix/default.nix b/systems/x86_64-linux/drivebystation-nix/default.nix index ee5ee9b..0a59fb8 100644 --- a/systems/x86_64-linux/drivebystation-nix/default.nix +++ b/systems/x86_64-linux/drivebystation-nix/default.nix @@ -43,7 +43,7 @@ in users.users.andreas = { isNormalUser = true; description = "Andreas Schaafsma"; - extraGroups = [ "networkmanager" "wheel" ] ; + extraGroups = [ "networkmanager" "wheel" "libvirtd" ] ; packages = with pkgs; [ # Packages from inputs inputs.game-of-life.packages.x86_64-linux.default @@ -64,6 +64,7 @@ in minecraft trilium-desktop terraform + virt-manager # thunderbird ]; }; diff --git a/systems/x86_64-linux/drivebystation-nix/hardware/acer-monitor-edid.nix b/systems/x86_64-linux/drivebystation-nix/hardware/acer-monitor-edid.nix index c9943fd..5a5fc76 100644 --- a/systems/x86_64-linux/drivebystation-nix/hardware/acer-monitor-edid.nix +++ b/systems/x86_64-linux/drivebystation-nix/hardware/acer-monitor-edid.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { # boot.kernelParams = [ "drm.edid_firmware=DP-1:edid/edid.bin,DP-2:edid/edid.bin,DP-3:edid/edid.bin,DP-4:edid/edid.bin" ]; - boot.kernelParams = [ "drm.edid_firmware=DP-1:edid/edid.bin,DP-2:edid/edid.bin,DP-3:edid/edid.bin" ]; + boot.kernelParams = [ "drm.edid_firmware=DP-2:edid/edid.bin" ]; hardware.firmware = [ diff --git a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/intel_nvidia.nix b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/intel_nvidia.nix index b6645c0..bf090f3 100644 --- a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/intel_nvidia.nix +++ b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/intel_nvidia.nix @@ -1,94 +1,74 @@ { config, lib, pkgs, ... }: + { + ############################ + ## Display + Mesa Settings + ############################ - # Enable OpenGL - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ - vaapiIntel - intel-media-driver - nvidia-vaapi-driver - vpl-gpu-rt # for newer intel GPUs on NixOS >24.05 or unstable - ]; - }; + # hardware.enableRedistributableFirmware = true; - # Load nvidia driver for Xorg and Wayland - # boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; - boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_beta ]; - # boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; + hardware.firmware = [ + pkgs.linux-firmware + pkgs.firmwareLinuxNonfree + # pkgs.firmwareLinuxStrict + # pkgs.firmwareLinuxLatest + ]; - - boot.loader.systemd-boot.consoleMode = "max"; + # boot.kernelPackages = pkgs.linuxPackages_latest; boot.kernelParams = [ - # "amdgpu.modeset=0" - "nvidia-drm.fbdev=1" + "console=tty0" + "efifb=off" + "xe.force_probe=*" "nvidia-drm.modeset=1" - "nvidia.NVreg_PreserveVideoMemoryAllocations=1" - "i915.force_probe=e2ff" - # "amd_iommu=on" - # "vfio-pci.ids=\"10de:2489,10de:228b\"" - # "nomodeset" - # "nvidia_drm.modeset=1" - ]; - boot.blacklistedKernelModules = [ - # "i915" - "nouveau" - "amdgpu" ]; + + hardware.graphics = { + enable = true; + + extraPackages = with pkgs; [ + intel-media-driver # Intel VAAPI + vpl-gpu-rt # oneVPL runtime + vaapiIntel # fallback + ]; + }; + + # Ensure Arc driver is available (usually auto-loaded) + boot.kernelModules = [ "xe" ]; + boot.blacklistedKernelModules = [ "nouveau" ]; + + ############################ + ## X / Wayland GPU Drivers + ############################ + # Only specify NVIDIA. Intel Arc uses the modesetting driver automatically. services.xserver.videoDrivers = [ "nvidia" ]; - boot.initrd.kernelModules = [ - "nvidia" - "nvidia_drm" - ]; + ############################ + ## NVIDIA Configuration + ############################ hardware.nvidia = { - modesetting.enable = true; + modesetting.enable = true; # REQUIRED if any displays are on NVIDIA - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = false; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. + open = false; # GTX 1070 → must be the proprietary driver nvidiaSettings = true; - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.beta; - # package = config.boot.kernelPackages.nvidiaPackages.none; - # package = config.boot.kernelPackages.nvidiaPackages.production; - - forceFullCompositionPipeline = true; + powerManagement.enable = false; + powerManagement.finegrained = false; prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - reverseSync.enable = false; - # Make sure to use the correct Bus ID values for your system! - intelBusId = "PCI:01:0:0"; - nvidiaBusId = "PCI:05:0:0"; - # amdgpuBusId = "PCI:50:0:0"; #For AMD GPU + offload.enable = false; # not a laptop, must be disabled + sync.enable = false; }; + # Correct way to pick the driver + package = config.boot.kernelPackages.nvidiaPackages.production; }; - users.users.andreas = { - extraGroups = [ "video" "render" ]; - }; + + # Remove → hardware.nvidia handles module packages + # boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; + + ############################ + ## User Access + ############################ + users.users.andreas.extraGroups = [ "video" "render" ]; } diff --git a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia-stable.nix b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia-stable.nix index 051635a..084610c 100644 --- a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia-stable.nix +++ b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia-stable.nix @@ -4,7 +4,7 @@ let in { my-namespace.hardware = { - graphics-nvidia-specializations = enabled; + # graphics-nvidia-specializations.enabled = false; # graphics-nvidia-prime-amd = enabled; # graphics-nvidia-prime-amd-testing = enabled; # graphics-amd-igpu-only = enabled; diff --git a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia.nix b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia.nix index 9fef385..e710589 100644 --- a/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia.nix +++ b/systems/x86_64-linux/drivebystation-nix/hardware/graphics/nvidia.nix @@ -16,11 +16,11 @@ boot.loader.systemd-boot.consoleMode = "max"; boot.kernelParams = [ - "amdgpu.modeset=1" + # "amdgpu.modeset=0" "nvidia-drm.fbdev=1" - "nvidia-drm.modeset=0" - # "nvidia.NVreg_PreserveVideoMemoryAllocations=0" - "amd_iommu=on" + "nvidia-drm.modeset=1" + "nvidia.NVreg_PreserveVideoMemoryAllocations=1" + # "amd_iommu=on" # "vfio-pci.ids=\"10de:2489,10de:228b\"" # "nomodeset" # "nvidia_drm.modeset=1" @@ -28,60 +28,22 @@ boot.blacklistedKernelModules = [ "i915" "nouveau" - # "nvidia" - # "nvidia-drm" - # "nvidia-uvm" - # "nvidiafb" - # "nvidia_drm" - # "nvidia_modeset" - ]; - # boot.extraModprobeConfig = '' - # blacklist nvidia - # blacklist nvidia-drm - # blacklist nvidia_drm - # blacklist nvidia-uvm - # blacklist nvidia_uvm - # blacklist nvidia_modeset - # blacklist nvidiafb - # blacklist nouveau - # options nouveau modeset=0 - # ''; - boot.extraModprobeConfig = '' - blacklist nouveau - options nouveau modeset=0 - ''; - # services.xserver.videoDrivers = [ "nvidia" ]; - services.xserver.videoDrivers = [ "amdgpu" "nvidia" ]; - - # services.udev.extraRules = '' - # # Remove NVIDIA USB xHCI Host Controller devices, if present - # ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" - # # Remove NVIDIA USB Type-C UCSI devices, if present - # ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1" - # # Remove NVIDIA Audio devices, if present - # ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1" - # # Remove NVIDIA VGA/3D controller devices - # ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" - # ''; - - boot.initrd.kernelModules = [ "amdgpu" + ]; + services.xserver.videoDrivers = [ "nvidia" ]; + + boot.initrd.kernelModules = [ "nvidia" - # "nvidia-drm" - "nvidiafb" - # "nvidia-uvm" - # "nvidia-modeset" - # "i2c-nvidia_gpu" + "nvidia_drm" ]; hardware.nvidia = { - # Modesetting is required. modesetting.enable = true; # Nvidia power management. Experimental, and can cause sleep/suspend to fail. # Enable this if you have graphical corruption issues or application crashes after waking # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead # of just the bare essentials. - powerManagement.enable = true; + powerManagement.enable = false; # Fine-grained power management. Turns off GPU when not in use. # Experimental and only works on modern Nvidia GPUs (Turing or newer). @@ -105,19 +67,19 @@ # package = config.boot.kernelPackages.nvidiaPackages.none; # package = config.boot.kernelPackages.nvidiaPackages.production; - forceFullCompositionPipeline = false; + forceFullCompositionPipeline = true; - prime = { - offload = { - enable = true; - enableOffloadCmd = true; - }; - reverseSync.enable = false; - # Make sure to use the correct Bus ID values for your system! - # intelBusId = "PCI:0:2:0"; - nvidiaBusId = "PCI:01:0:0"; - amdgpuBusId = "PCI:50:0:0"; #For AMD GPU - }; + # prime = { + # offload = { + # enable = true; + # enableOffloadCmd = true; + # }; + # reverseSync.enable = false; + # # Make sure to use the correct Bus ID values for your system! + # # intelBusId = "PCI:0:2:0"; + # nvidiaBusId = "PCI:01:0:0"; + # amdgpuBusId = "PCI:50:0:0"; #For AMD GPU + # }; }; users.users.andreas = { diff --git a/systems/x86_64-linux/drivebystation-nix/hardware/hardware-configuration.nix b/systems/x86_64-linux/drivebystation-nix/hardware/hardware-configuration.nix index 87d9707..7abbb7a 100644 --- a/systems/x86_64-linux/drivebystation-nix/hardware/hardware-configuration.nix +++ b/systems/x86_64-linux/drivebystation-nix/hardware/hardware-configuration.nix @@ -7,18 +7,19 @@ imports = [ (modulesPath + "/installer/scan/not-detected.nix") - ./graphics/nvidia-stable.nix + ./graphics/intel_nvidia.nix # ./graphics/nvidia.nix ./acer-monitor-edid.nix ]; - #boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.linuxPackages_latest; + hardware.enableRedistributableFirmware = true; # boot.kernelPackages = pkgs.linuxKernel.packages.linux_xanmod_latest; - boot.kernelPackages = pkgs.linuxPackages; + # boot.kernelPackages = pkgs.linuxPackages; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.kernelModules = [ "kvm-amd" "4vl2loopback" ]; - boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ]; - + boot.extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; + boot.supportedFilesystems = [ "ntfs" ]; boot.blacklistedKernelModules = [ ]; fileSystems."/" = { device = "/dev/disk/by-uuid/563805a1-5277-4488-bbdd-c1a7ed37be76"; diff --git a/systems/x86_64-linux/drivebystation-nix/video.nix b/systems/x86_64-linux/drivebystation-nix/video.nix index 2708583..ed26a31 100644 --- a/systems/x86_64-linux/drivebystation-nix/video.nix +++ b/systems/x86_64-linux/drivebystation-nix/video.nix @@ -5,7 +5,7 @@ ]; boot.extraModulePackages = [ - pkgs.linuxPackages.v4l2loopback # Webcam loopback + config.boot.kernelPackages.v4l2loopback # Webcam loopback ]; boot.extraModprobeConfig = ''