hibernation works now
This commit is contained in:
parent
7645da455e
commit
83db3ded50
121
modules/hardware/novidia.nix
Normal file
121
modules/hardware/novidia.nix
Normal file
@ -0,0 +1,121 @@
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.my-namespace.hardware.novidia;
|
||||
in
|
||||
{
|
||||
options.my-namespace.hardware.novidia = {
|
||||
enable = mkEnableOption "Bypass nvidia driver";
|
||||
};
|
||||
hardware.graphics = mkIf cfg.enable{
|
||||
enable = false;
|
||||
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
# Enable OpenGL
|
||||
hardware.graphics = {
|
||||
enable = false;
|
||||
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
||||
};
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_production ];
|
||||
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
|
||||
boot.loader.systemd-boot.consoleMode = "max";
|
||||
|
||||
boot.kernelParams = [
|
||||
# "nvidia-drm.fbdev=1"
|
||||
# "nvidia-drm.modeset=1"
|
||||
# "nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||
# "nomodeset"
|
||||
# "nvidia_drm.modeset=1"
|
||||
];
|
||||
boot.blacklistedKernelModules = [
|
||||
"i915"
|
||||
"nouveau"
|
||||
];
|
||||
boot.extraModprobeConfig = ''
|
||||
blacklist nouveau
|
||||
options nouveau modeset=0
|
||||
'';
|
||||
# boot.extraModprobeConfig = "options nvidia " + lib.concatStringsSep " " [
|
||||
# # nvidia assume that by default your CPU does not support PAT,
|
||||
# # but this is effectively never the case in 2023
|
||||
# "NVreg_UsePageAttributeTable=1"
|
||||
# # This may be a noop, but it's somewhat uncertain
|
||||
# "NVreg_EnablePCIeGen3=1"
|
||||
# # This is sometimes needed for ddc/ci support, see
|
||||
# # https://www.ddcutil.com/nvidia/
|
||||
# #
|
||||
# # Current monitor does not support it, but this is useful for
|
||||
# # the future
|
||||
# "NVreg_RegistryDwords=RMUseSwI2c=0x01;RMI2cSpeed=100"
|
||||
# # When (if!) I get another nvidia GPU, check for resizeable bar
|
||||
# # settings
|
||||
# ];
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
boot.initrd.kernelModules = [
|
||||
# "nvidia"
|
||||
# "nvidia-drm"
|
||||
# "nvidiafb"
|
||||
# "nvidia-modeset"
|
||||
# "nvidia-uvm"
|
||||
# "i2c-nvidia_gpu"
|
||||
];
|
||||
#boot.initrd.kernelModules = [ "nvidia" ];
|
||||
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.nvidia = {
|
||||
nvidiaPersistenced = true;
|
||||
# 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.stable;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
|
||||
};
|
||||
hardware.nvidia.prime = {
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
# 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 = {
|
||||
extraGroups = [ "video" "render" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
118
modules/hardware/nvidia-stable.nix
Normal file
118
modules/hardware/nvidia-stable.nix
Normal file
@ -0,0 +1,118 @@
|
||||
{ pkgs
|
||||
, config
|
||||
, lib
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
inherit (lib) mkEnableOption mkIf;
|
||||
cfg = config.my-namespace.hardware.nvidia-stable;
|
||||
in
|
||||
{
|
||||
options.my-namespace.hardware.nvidia-stable = {
|
||||
enable = mkEnableOption "Enable stable NVIDIA drivers";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
# Enable OpenGL
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = with pkgs; [ nvidia-vaapi-driver ];
|
||||
};
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_production ];
|
||||
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
|
||||
|
||||
boot.loader.systemd-boot.consoleMode = "max";
|
||||
|
||||
boot.kernelParams = [
|
||||
"nvidia-drm.fbdev=1"
|
||||
"nvidia-drm.modeset=1"
|
||||
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||
"nomodeset"
|
||||
# "nvidia_drm.modeset=1"
|
||||
];
|
||||
boot.blacklistedKernelModules = [
|
||||
"i915"
|
||||
"nouveau"
|
||||
];
|
||||
# boot.extraModprobeConfig = "options nvidia " + lib.concatStringsSep " " [
|
||||
# # nvidia assume that by default your CPU does not support PAT,
|
||||
# # but this is effectively never the case in 2023
|
||||
# "NVreg_UsePageAttributeTable=1"
|
||||
# # This may be a noop, but it's somewhat uncertain
|
||||
# "NVreg_EnablePCIeGen3=1"
|
||||
# # This is sometimes needed for ddc/ci support, see
|
||||
# # https://www.ddcutil.com/nvidia/
|
||||
# #
|
||||
# # Current monitor does not support it, but this is useful for
|
||||
# # the future
|
||||
# "NVreg_RegistryDwords=RMUseSwI2c=0x01;RMI2cSpeed=100"
|
||||
# # When (if!) I get another nvidia GPU, check for resizeable bar
|
||||
# # settings
|
||||
# ];
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
boot.initrd.kernelModules = [
|
||||
"nvidia"
|
||||
"nvidia-drm"
|
||||
# "nvidiafb"
|
||||
# "nvidia-modeset"
|
||||
# "nvidia-uvm"
|
||||
# "i2c-nvidia_gpu"
|
||||
];
|
||||
#boot.initrd.kernelModules = [ "nvidia" ];
|
||||
|
||||
hardware.enableAllFirmware = true;
|
||||
hardware.nvidia = {
|
||||
nvidiaPersistenced = true;
|
||||
# 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.stable;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
|
||||
};
|
||||
hardware.nvidia.prime = {
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true;
|
||||
};
|
||||
# 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
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs [
|
||||
pkgs.nvtopPackages.nvidia
|
||||
];
|
||||
|
||||
users.users.andreas = {
|
||||
extraGroups = [ "video" "render" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./hardware-configuration.nix
|
||||
./hardware/hardware-configuration.nix
|
||||
];
|
||||
|
||||
# Bootloader.
|
||||
|
||||
@ -43,7 +43,7 @@ in
|
||||
users.users.andreas = {
|
||||
isNormalUser = true;
|
||||
description = "Andreas Schaafsma";
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
extraGroups = [ "networkmanager" "wheel" ] ;
|
||||
packages = with pkgs; [
|
||||
flatpak
|
||||
gnome-software
|
||||
@ -73,6 +73,7 @@ in
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
|
||||
# Install firefox.
|
||||
programs.firefox.enable = true;
|
||||
nixpkgs.config.allowBroken = true;
|
||||
@ -87,8 +88,6 @@ in
|
||||
pkgs.my-namespace.udev-steelseries
|
||||
pkgs.my-namespace.hello
|
||||
|
||||
pkgs.nvtopPackages.nvidia
|
||||
|
||||
# stuff I installed to try to get gamescope to work to no avail Gamescope is just broken it seems.
|
||||
# pkgs.mesa
|
||||
# pkgs.vulkan-loader
|
||||
@ -130,9 +129,9 @@ in
|
||||
|
||||
# Disable the GNOME3/GDM auto-suspend feature that cannot be disabled in GUI!
|
||||
# If no user is logged in, the machine will power down after 20 minutes.
|
||||
systemd.targets.sleep.enable = false;
|
||||
systemd.targets.suspend.enable = false;
|
||||
systemd.targets.hibernate.enable = false;
|
||||
systemd.targets.hybrid-sleep.enable = false;
|
||||
systemd.targets.sleep.enable = true;
|
||||
systemd.targets.suspend.enable = true;
|
||||
systemd.targets.hibernate.enable = true;
|
||||
systemd.targets.hybrid-sleep.enable = true;
|
||||
};
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
boot.kernelParams = [ "drm.edid_firmware=DP-3:edid/edid.bin" ];
|
||||
boot.kernelParams = [ "drm.edid_firmware=DP-6:edid/edid.bin" ];
|
||||
|
||||
hardware.firmware = [
|
||||
(
|
||||
@ -0,0 +1,10 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
inherit (lib.my-namespace) enabled;
|
||||
in
|
||||
{
|
||||
lib.my-namespace.hardware = {
|
||||
novidia = enabled;
|
||||
#nvidia-stable.enabled = enabled;
|
||||
};
|
||||
}
|
||||
@ -9,8 +9,8 @@
|
||||
|
||||
# Load nvidia driver for Xorg and Wayland
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_production ];
|
||||
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_production ];
|
||||
# boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
|
||||
|
||||
|
||||
boot.loader.systemd-boot.consoleMode = "max";
|
||||
@ -18,40 +18,72 @@
|
||||
boot.kernelParams = [
|
||||
"nvidia-drm.fbdev=1"
|
||||
"nvidia-drm.modeset=1"
|
||||
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||
"nomodeset"
|
||||
# "nvidia.NVreg_PreserveVideoMemoryAllocations=0"
|
||||
"amd_iommu=on"
|
||||
"amdgpu.modeset=1"
|
||||
# "vfio-pci.ids=\"10de:2489,10de:228b\""
|
||||
# "nomodeset"
|
||||
# "nvidia_drm.modeset=1"
|
||||
];
|
||||
boot.blacklistedKernelModules = [
|
||||
"i915"
|
||||
"amdgpu"
|
||||
"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 = [ "nvidia" ];
|
||||
services.xserver.videoDrivers = [ "amdgpu" ];
|
||||
|
||||
# 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"
|
||||
"nvidia_uvm"
|
||||
"nvidia_drm"
|
||||
"nvidia"
|
||||
"nvidia-drm"
|
||||
# "nvidiafb"
|
||||
# "nvidia-modeset"
|
||||
# "nvidia-uvm"
|
||||
"nvidiafb"
|
||||
"nvidia-modeset"
|
||||
"nvidia-uvm"
|
||||
# "i2c-nvidia_gpu"
|
||||
];
|
||||
#boot.initrd.kernelModules = [ "nvidia" ];
|
||||
|
||||
|
||||
];
|
||||
hardware.nvidia = {
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
modesetting.enable = false;
|
||||
|
||||
# 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;
|
||||
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).
|
||||
@ -71,8 +103,10 @@
|
||||
nvidiaSettings = true;
|
||||
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.none;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.production;
|
||||
|
||||
|
||||
};
|
||||
users.users.andreas = {
|
||||
@ -7,7 +7,8 @@
|
||||
imports =
|
||||
[
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
./nvidia.nix
|
||||
./graphics/nvidia-stable.nix
|
||||
./graphics/nvidia.nix
|
||||
./acer-monitor-edid.nix
|
||||
];
|
||||
#boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
@ -30,11 +31,21 @@
|
||||
options = [ "fmask=0077" "dmask=0077" ];
|
||||
};
|
||||
|
||||
|
||||
|
||||
# Try to fix hibernation
|
||||
|
||||
# swapDevices = [ ];
|
||||
swapDevices = [ {
|
||||
device = "/var/lib/swapfile";
|
||||
size = 32*1024;
|
||||
} ];
|
||||
} ]; #resume-offset = 78399488
|
||||
boot.resumeDevice = "/dev/disk/by-uuid/563805a1-5277-4488-bbdd-c1a7ed37be76"; # the unlocked drive mapping
|
||||
boot.kernelParams = [
|
||||
"resume_offset=78399488" #sudo filefrag -v /var/lib/swapfile|awk 'NR==4{gsub(/\./,"");print $4;}'
|
||||
];
|
||||
security.protectKernelImage = false;
|
||||
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
Loading…
x
Reference in New Issue
Block a user