I use pkgs.linuxKernel.packages.linux_6_10, kernel reported by hyfetch is 6.10.12
Ah, never mind. If youâre on NixOS stable, you also need vulkan-headers
:
I think you can either add that to nvidia-settingsâ buildInputs or just disable it with hardware.nvidia.nvidiaSettings = false;
How could I add it? Iâm not well versed in this kind of thing. Iâd like to keep nvidiaSettings enabled if possible.
Disable nvidiaSettings
from the module and use this instead:
environment.systemPackages =
let
nvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers;
in
lib.optionals nvidiaEnabled [
(config.hardware.nvidia.package.settings.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-headers ];
}))
];
You donât have to use nvidiaEnabled
, but itâs better to only install nvidia-settings
when the proprietary drivers are enabled.
I already have environment.systemPackages
used, how can I add implement this with my current environment.systemPackages = with pkgs; [];
?
You can concatenate the lists with ++
:
environment.systemPackages =
let
nvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers;
in
(with pkgs; [
hello
])
++ lib.optionals nvidiaEnabled [
(config.hardware.nvidia.package.settings.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-headers ];
}))
];
error: undefined variable 'lib'
at /nix/store/552krrkm0284561s1jipn8g76wlb882d-source/configuration.nix:388:23:
387| let
388| nvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers;
| ^
389| in
You need to add lib
and config
to your moduleâs inputs, just like what youâre doing with pkgs
:
{
config,
lib,
pkgs,
...
}:
{
environment.systemPackages = ...
}
Itâs still trying to build the nvidiaSettings from the driver instead of the method we just went over before. Same error âNo Vulkan headerâ.
Yes, I disabled the nvidiaSettings in hardware.nvidia
I may be stupid though. Can you elaborate on
I meant disable as in hardware.nvidia.nvidiaSettings = false;
Yeah, Iâve done that
# fuck nvidia
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
#package = config.boot.kernelPackages.nvidiaPackages.latest;
open = false;
nvidiaSettings = false;
modesetting.enable = true;
powerManagement.enable = true;
};
#hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "560.35.03";
sha256_64bit = "sha256-8pMskvrdQ8WyNBvkU/xPc/CtcYXCa7ekP73oGuKfH+M=";
sha256_aarch64 = "sha256-s8ZAVKvRNXpjxRYqM3E5oss5FdqW+tv1qQC2pDjfG+s=";
openSha256 = "sha256-/32Zf0dKrofTmPZ3Ratw4vDM7B+OgpC4p7s+RHUjCrg=";
settingsSha256 = "";
persistencedSha256 = "sha256-E2J2wYYyRu7Kc3MMZz/8ZIemcZg68rkzvqEwFAL3fFs=";
};
};
That should work, are you sure youâre actually building that bit of configuration? The settingsSha256
probably still needs to be set to a real sha, even if you donât install the settings, since it will be built as part of the package regardless, so that config should fail to do anything before you get to the settings build step.
Alternatively, NixOS unstable has that version of the nvidia driver, with the required additional dependency, so you can skip all these hacks if you switch to unstable.
I no longer get a vulkan header error, but I get a modprobe error:
modprobe: FATAL: Module nvidia not found in directory /nix/store/6b8am1swsxndyzaqqwxiy9k1ykcsr7mi-linux-6.10.12-modules/lib/modules/6.10.12
Culprit:
boot.initrd.kernelModules = [ "nvidia" "nvidia_drm" "nvidia_uvm" "nvidia_modeset" ];
Adding
boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
results in
error: builder for '/nix/store/70f4xf2jns8axzh45yv47nfbfp7qjzam-nvidia-x11-550.78-6.10.13.drv' failed with exit code 2;
last 10 log lines:
> /build/NVIDIA-Linux-x86_64-550.78/kernel/common/inc/nv-linux.h: In function 'nv_vmap':
> /build/NVIDIA-Linux-x86_64-550.78/kernel/common/inc/nv-linux.h:674:51: warning: suggest braces around empty body in an 'if' statement [8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wempty-body-Wempty-body8;;]
> 674 | NV_MEMDBG_ADD(ptr, page_count * PAGE_SIZE);
> | ^
> make[3]: *** [/nix/store/jq4497swi7i7b92p6qnkwa8f5c7vlqyi-linux-6.10.13-dev/lib/modules/6.10.13/source/Makefile:1934: /build/NVIDIA-Linux-x86_64-550.78/kernel] Error 2
> make[2]: *** [/nix/store/jq4497swi7i7b92p6qnkwa8f5c7vlqyi-linux-6.10.13-dev/lib/modules/6.10.13/source/Makefile:240: __sub-make] Error 2
> make[2]: Leaving directory '/nix/store/jq4497swi7i7b92p6qnkwa8f5c7vlqyi-linux-6.10.13-dev/lib/modules/6.10.13/build'
> make[1]: *** [Makefile:240: __sub-make] Error 2
> make[1]: Leaving directory '/nix/store/jq4497swi7i7b92p6qnkwa8f5c7vlqyi-linux-6.10.13-dev/lib/modules/6.10.13/source'
> make: *** [Makefile:85: modules] Error 2
For full logs, run 'nix log /nix/store/70f4xf2jns8axzh45yv47nfbfp7qjzam-nvidia-x11-550.78-6.10.13.drv'.
Donât add those manually, at best itâs superfluous, at worst you mess with the order in which things should be loaded - theyâre already added by the nvidia module if you have xserver enabled: nixpkgs/nixos/modules/hardware/video/nvidia.nix at 6e6b3dd395c3b1eb9be9f2d096383a8d05add030 ¡ NixOS/nixpkgs ¡ GitHub
nvidia_uvm
specifically is more complex, youâre breaking the NixOS module: nixpkgs/nixos/modules/hardware/video/nvidia.nix at 6e6b3dd395c3b1eb9be9f2d096383a8d05add030 ¡ NixOS/nixpkgs ¡ GitHub
Can you share your whole config? Itâs a bit hard to help when every time we get somewhere it turns out thereâs more stuff sleeping in your configuration x)
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./modules/env.nix
];
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "555.58.02";
sha256_64bit = "sha256-xctt4TPRlOJ6r5S54h5W6PT6/3Zy2R4ASNFPu8TSHKM=";
sha256_aarch64 = "sha256-wb20isMrRg8PeQBU96lWJzBMkjfySAUaqt4EgZnhyF8=";
openSha256 = "sha256-8hyRiGB+m2hL3c9MDA/Pon+Xl6E788MZ50WrrAGUVuY=";
settingsSha256 = "sha256-ZpuVZybW6CFN/gz9rx+UJvQ715FZnAOYfHn5jt5Z2C8=";
persistencedSha256 = "sha256-a1D7ZZmcKFWfPjjH1REqPM5j/YLWKnbkP9qfRyIyxAw=";
};
# The nvidia-settings build is currently broken due to a missing
# vulkan header; re-enable whenever
# 0384602eac8bc57add3227688ec242667df3ffe3the hits stable.
nvidiaSettings = false;
modesetting.enable = true;
# Power management is required to get nvidia GPUs to behave on
# suspend, due to firmware bugs. Aren't nvidia great?
powerManagement.enable = true;
open = true;
};
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Kernel
#boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelPackages = pkgs.linuxKernel.packages.linux_6_10;
boot.blacklistedKernelModules = [ "amdgpu" ];
boot.kernelParams =
[
"amd_iommu=on"
# slim HD 5450 650M 1GB DDR3
#"vfio-pci.ids=1002:68f9,1002:aa68,"
# thicc HD 4870 1GB DDR5
"vfio-pci.ids=1002:9440,1002:aa30,"
];
boot.kernelModules = [
"vfio_virqfd"
"vfio_pci"
"vfio_iommu_type1"
"vfio"
"nct6775"
];
boot.extraModprobeConfig = "options vfio-pci ids=1002:68f9,1002:aa68";
boot.initrd.kernelModules = [ "nvidia" "nvidia_drm" "nvidia_uvm" "nvidia_modeset" ];
#boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
};
services.udev.extraRules = ''
# Pen Tablet
SUBSYSTEM=="usb", ATTRS{product}=="XP-Pen Artist 12 (2nd Gen)", ATTRS{idProduct}=="094a", ATTRS{idVendor}=="28bd", MODE="0660", GROUP="plugdev"
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0666", GROUP="plugdev"
# Arduino
KERNEL=="ttyUSB*", SUBSYSTEM=="tty", SUBSYSTEMS=="usb-serial", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", MODE="0666", GROUP="plugdev"
#SUBSYSTEMS=="usb", ATTRS{idProduct}=="7523", ATTRS{idVendor}=="1a86", MODE="0666", GROUP="plugdev"
'';
# file system shenanigans
fileSystems."/mnt/Games" =
{
device = "/dev/disk/by-uuid/9226e50e-fc7b-4a95-baac-a59b1d779899";
fsType = "ext4";
options =
[
"users"
"nofail"
"x-gvfs-show"
"exec"
];
label = "Games";
};
fileSystems."/mnt/SeagateBarracuda" =
{
device = "/dev/disk/by-uuid/1b78ca3b-618f-496f-8a6e-d4e575f5d84b";
fsType = "ext4";
options =
[
"users"
"nofail"
"x-gvfs-show"
"exec"
];
label = "Seagate Barracuda";
};
fileSystems."/mnt/HGST" =
{
device = "/dev/disk/by-uuid/a18e9a89-3b84-4bc0-85fc-5828bd1e7342";
fsType = "ext4";
options =
[
"users"
"nofail"
"x-gvfs-show"
"exec"
];
label = "HGST";
};
fileSystems."/mnt/WinVM" =
{
device = "/dev/disk/by-uuid/3199b99a-c2f5-42c7-b41e-11d83b97da4d";
fsType = "ext4";
options =
[
"users"
"x-gvfs-show"
"exec"
];
label = "WinVM";
};
fileSystems."/mnt/smb" = {
device = "//192.168.0.16/nika";
fsType = "cifs";
options = let
automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s,user,users";
in ["${automount_opts},credentials=/home/nika/.dotfiles/smb-secrets,uid=1000,gid=100"];
};
# fuck nvidia
# services.xserver.videoDrivers = ["nvidia"];
# hardware.nvidia = {
# #package = config.boot.kernelPackages.nvidiaPackages.latest;
# open = false;
# #nvidiaSettings = true;
# modesetting.enable = true;
# powerManagement.enable = true;
# };
#
# #hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.latest;
# hardware.nvidia = {
# package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
# version = "560.35.03";
# sha256_64bit = "sha256-8pMskvrdQ8WyNBvkU/xPc/CtcYXCa7ekP73oGuKfH+M=";
# sha256_aarch64 = "sha256-s8ZAVKvRNXpjxRYqM3E5oss5FdqW+tv1qQC2pDjfG+s=";
# openSha256 = "sha256-/32Zf0dKrofTmPZ3Ratw4vDM7B+OgpC4p7s+RHUjCrg=";
# settingsSha256 = "sha256-kQsvDgnxis9ANFmwIwB7HX5MkIAcpEEAHc8IBOLdXvk=";
# persistencedSha256 = "sha256-E2J2wYYyRu7Kc3MMZz/8ZIemcZg68rkzvqEwFAL3fFs=";
# };
# nvidiaSettings = false;
# };
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;
# Enable Wayland windowing system
# services.displayManager.sddm.wayland.enable = true;
# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Bluetooth
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
};
hardware.opentabletdriver.enable = true;
# turn off the daemon service - it's borked afaik so for now I'll just use autostart until there either there's a fix or I'll fix it
hardware.opentabletdriver.daemon.enable = true;
services.hardware.openrgb.enable = true;
# Create WiFi Hotspot
# services.create_ap = {
# enable = true;
# settings = {
# INTERNET_IFACE = "enp42s0f3u3";
# WIFI_IFACE = "wlo1";
# WPA_VERSION = "3";
# FREQ_BAND = "2.4";
# SSID = "FC-Kiffen";
# PASSPHRASE = "ZA8r2dXB3KddEn";
# };
# };
services.avahi.enable = true;
services.avahi.nssmdns4 = true;
# Enable sound with pipewire.
# hardware.pulseaudio = {
# enable = true;
# extraConfig = "load-module module-equalizer-sink\nload-module module-dbus-protocol";
# };
# security.rtkit.enable = true;
# By default, NixOS uses Pipewire. Below is the default setting
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# extraConfig.pipewire =
# {
# "10-null-sink" = {
# context.objects = [
# { factory = "adapter";
# args = {
# factory.name = "support.null-audio-sink";
# node.name = "my-sink";
# media.class = "Audio/Sink";
# audio.position = [ "FL" "FR" "FC" "LFE" "RL" "RR" ];
# monitor.channel-volumes = true;
# monitor.passthrough = true;
# adapter.auto-port-config = {
# mode = "dsp";
# monitor = true;
# position = "preserve";
# };
# };
# }
# ];
# };
# };
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# TLP Power management
# services.tlp = {
# enable = true;
# settings = {
# CPU_SCALING_GOVERNOR_ON_BAT="performance";
# CPU_SCALING_GOVERNOR_ON_AC="performance";
#
# # 100 is max
# CPU_MAX_PERF_ON_BAT=100;
# CPU_MAX_PERF_ON_AC=100;
# };
# };
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
users.groups.plugdev = {};
# Define a user account. Don't forget to set a password with âpasswdâ.
users.users.nika = {
isNormalUser = true;
description = "nika";
extraGroups = [ "networkmanager" "wheel" "libvirtd" "wireshark" "openrazer" "scanner" "lp" "plugdev" ];
packages = with pkgs; [
kdePackages.kate
# thunderbird
];
};
services.davfs2.enable = true;
services.samba.enable = true;
#services.monero.enable = true;
# services.xmrig = {
# enable = true;
# settings = {
# autosave = true;
# cpu = true;
# opencl = false;
# cuda = true;
# pools = [
# {
# url = "pool.supportxmr.com:443";
# user = "your-wallet";
# keepalive = true;
# tls = true;
# }
# ];
# };
# };
# Install firefox.
programs.firefox.enable = true;
# Install Steam
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
# install git
programs.git = {
enable = true;
};
programs.wireshark = {
enable = true;
};
programs.coolercontrol.enable = true;
hardware.openrazer.enable = true;
#nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
# "steam"
# "steam-original"
# "steam-run"
#];
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# libvirtdeez nuts AAAAAAAAAAAAaa
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];
};
vhostUserPackages = [
pkgs.virtiofsd
];
};
};
# Automatically delete generations older than 30 days every week
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# specialisation."VFIO".configuration = {
# system.nixos.tags = [ "with-vfio" ];
# vfio.enable = true;
#};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages =
let
nvidiaEnabled = lib.elem "nvidia" config.services.xserver.videoDrivers;
in
(with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
librewolf
lshw
vlc
wineWowPackages.stable
winetricks
gparted
ntfs3g
kdePackages.yakuake
htop
_1password-gui
vencord
spotify
obs-studio
cowsay
kdePackages.kalarm
nextcloud-client
pciutils
exfat
wireshark
exfatprogs
cifs-utils
kdePackages.kdenlive
#glaxnimate
hyfetch
openrazer-daemon
polychromatic
libsForQt5.skanlite
#gnome.simple-scan
openrgb-with-all-plugins
popsicle
#libsForQt5.xp-pen-g430-driver
krita
#libsForQt5.xp-pen-deco-01-v2-driver
tmuxPlugins.open
screen
# linux-wallpaperengine
signal-desktop
monero-gui
qpaeq
xmrig
vesktop
coolercontrol.coolercontrol-gui
coolercontrol.coolercontrol-ui-data
lm_sensors
yt-dlp
arduino
usbutils
audacity
freerdp3
remmina
xclicker
dotnetCorePackages.sdk_8_0_2xx
icu
vscode
qdirstat
kdePackages.kget
#kdePackages.kcolorpicker
#libsForQt5.kcolorpicker
xcolor
kdiskmark
gsmartcontrol
qpwgraph
libreoffice
esptool
kdePackages.korganizer
# QEMU stuff
qemu
virt-manager
virt-viewer
dnsmasq
vde2
bridge-utils
netcat-openbsd
libguestfs
libvirt
])
++ lib.optionals nvidiaEnabled [
(config.hardware.nvidia.package.settings.overrideAttrs (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.vulkan-headers ];
}))
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Itâs perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}
I havenât done anything since my last reply.
Thanks! Do you still get a complaint about that module if you omit the manual additons to boot.initrd.kernelModules
? Also, you seem to have gone to nvidia driver version 555.58.02
instead of the 560.35.03
you were trying earlier - itâs quite possible the former is just incompatible with this kernel version.
Removing boot.initrd.kernelModules
lets me successfully build. Problem is that I think my driver just doesnât exist when I do that. GPU things are not there, even nvidia-settings.
Building the system now with the previous driver still gives me the modprobe error.