Hello there !
I am a newbie to nixos, coming from arch ;
I installed nixos on a laptop that has a nvidia gpu, using the lines stated in the nixos doc, and then tried to launch Cyberpunk 2077 for a test (it worked under arch), using the flatpak version of steam. It didn’t work.
I tried to debug the problem for hours over the past week, that’s why I’m coming here for help :')
My goal is to be able to play 3d games on nixos
I have a NVIDIA Geforce GTX 1660 Ti Mobile as a graphic card
Here is the output of vulkaninfo | grep “GPU id” →
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /nix/store/ix0zwzwpxcz5znli5n89344r99jvr558-mesa-24.0.7-drivers/lib/libvulkan_dzn.so. Skipping this driver.
WARNING: [Loader Message] Code 0 : terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /nix/store/ix0zwzwpxcz5znli5n89344r99jvr558-mesa-24.0.7-drivers/lib/libvulkan_virtio.so. Skipping this driver.
DRM kernel driver ‘nvidia-drm’ in use. NVK requires nouveau.
ERROR: […/src/nouveau/vulkan/nvk_physical_device.c:935] Code 0 : VK_ERROR_INCOMPATIBLE_DRIVER
GPU id = 0 (NVIDIA GeForce GTX 1660 Ti)
GPU id = 1 (llvmpipe (LLVM 17.0.6, 256 bits))
GPU id = 0 (NVIDIA GeForce GTX 1660 Ti)
GPU id = 1 (llvmpipe (LLVM 17.0.6, 256 bits))
GPU id = 0 (NVIDIA GeForce GTX 1660 Ti)
GPU id = 1 (llvmpipe (LLVM 17.0.6, 256 bits))
GPU id = 0 (NVIDIA GeForce GTX 1660 Ti)
GPU id = 1 (llvmpipe (LLVM 17.0.6, 256 bits))
GPU id : 0 (NVIDIA GeForce GTX 1660 Ti):
GPU id : 1 (llvmpipe (LLVM 17.0.6, 256 bits)):
Here is the error message when trying to launch cyberpunk 2077 →
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags QSurfaceFormat::FormatOption(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize 8, stencilBufferSize 8, samples 0, swapBehavior QSurfaceFormat::DefaultSwapBehavior, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile) .
This is most likely caused by not having the necessary graphics drivers installed.
Install a driver providing OpenGL 2.0 or higher, or, if tyhis is not possible, make sure the ANGLE Open GL ES 2.0 emulation libraries (libEGL.dll, libGLESv2.dll and d3dcompiler_*.dll) are available in the application executable’s directory or in a location listed in PATH.
And here is my config →
Edit this configuration file to define what should be installed on
your system. Help is available in the configuration.nix(5) man page
and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, … }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = “OysterLaptop”; # Define your hostname.
networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
Enable networking
networking.networkmanager.enable = true;
Set your time zone.
time.timeZone = “Europe/Paris”;
Select internationalisation properties.
i18n.defaultLocale = “en_US.UTF-8”;
i18n.extraLocaleSettings = {
LC_ADDRESS = “fr_FR.UTF-8”;
LC_IDENTIFICATION = “fr_FR.UTF-8”;
LC_MEASUREMENT = “fr_FR.UTF-8”;
LC_MONETARY = “fr_FR.UTF-8”;
LC_NAME = “fr_FR.UTF-8”;
LC_NUMERIC = “fr_FR.UTF-8”;
LC_PAPER = “fr_FR.UTF-8”;
LC_TELEPHONE = “fr_FR.UTF-8”;
LC_TIME = “fr_FR.UTF-8”;
};
Enable window manager
services.xserver.enable = true;
services.displayManager.enable = true;
services.xserver.windowManager.bspwm.enable = true;
Configure keymap in X11
services.xserver.xkb = {
layout = “fr”;
variant = “azerty”;
};
Configure console keymap
console.keyMap = “fr”;
Enable CUPS to print documents.
services.printing = {
enable = true;
#drivers = [ pkgs.gutenprint pkgs.hplip pkgs.postscript-lexmark pkgs.samsung-unified-linux-driver pkgs.splix pkgs.brlaser pkgs.brgenml1lpr pkgs.cnijfilter2 ];
};
Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# 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;
};
Enable bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = true;
Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
Enable nvidia fucking driver
services.xserver.videoDrivers = [ “nvidia” ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
programs.steam.enable = true;
programs.steam.gamescopeSession.enable = true;
programs.gamemode.enable = true;
boot.kernelParams = [ “nvidia-drm.fbdev=1” ];
Debugging gtk going batshit because of nvidia
environment.variables = {
GDK_SCALE = 1;
GDK_DPI_SCALE = 0.8;
};
Enable usb automounting
services.gvfs.enable = true;
Enable flatpak
services.flatpak.enable = true;
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
#the packages installed via flatpak are:
#itch
#steam
Define a user account. Don’t forget to set a password with ‘passwd’.
users.users.fifi = {
isNormalUser = true;
description = “fifi”;
extraGroups = [ “networkmanager” “wheel” ];
packages = with pkgs; [
bspwm
];
};
Allow unfree packages
nixpkgs.config.allowUnfree = true;
Allow executables
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
];
Disable nano
programs.nano.enable = false;
List packages installed in system profile. To search, run:
$ nix search wget
environment.systemPackages = with pkgs; [
#–Utils–
bluez
bluez-tools
wineWowPackages.stable
#–For Video Games–
vulkan-tools
steam-run
#–Desktop Environment–
bspwm
sxhkd
polybar
dunst
picom
xlockmore
feh
polkit_gnome
#–GUI theming–
colloid-gtk-theme
papirus-icon-theme
lxappearance
qt5ct
#–Term emulator–
alacritty
xterm
st
cool-retro-term
kitty
#–App launcher–
dmenu-rs
#–Text Editors–
vim
leafpad
#–GUI utility–
localsend
xfce.thunar
pcmanfm
spotify
simplescreenrecorder
ksnip
arandr
orca-slicer
popsicle
gparted
gcolor2
xcolor
#–media players–
vlc
celluloid
loupe
f3d
fontpreview
#–TUI utility–
ranger #file manager
superfile #file manager
duf #disk usage util
bluetuith #bluetooth manager
pulsemixer #sound manager // uses pipewire
cava #sound vizualiser
htop #system monitor
batmon #battery manager
peaclock #term clock
gping #ping a server, but graphically
bandwhich #wifi packets analyzer
numbat #calculator
neofetch
#–CLI tools–
brightnessctl
pamixer
xdotool
colorpicker
p7zip
zip
unzip
optipng
fast-cli
imagemagick
playerctl
w3m
lshw
glxinfo
#–TUI games–
bastet #tetris
chess-tui
minesweep-rs
sssnake
n2048
#–GUI work tools–
gimp
inkscape
scribus
blender
freecad
godot_4
#–web browsers–
tor-browser
chromium
librewolf
firefox
#–messaging apps–
tutanota-desktop
discord
signal-desktop
#–cybersecurity–
clamav
firejail
];
Install fonts
fonts.packages = with pkgs; [
pixel-code
chunk
league-gothic
the-neue-black
orbitron
fanwood
knewave
sniglet
iosevka
noto-fonts
noto-fonts-color-emoji
noto-fonts-monochrome-emoji
];
Write config files
system.activationScripts.bspwm = {
text = ‘’
mkdir -p /home/fifi/.config/bspwm
cat > /home/fifi/.config/bspwm/bspwmrc <<EOF
#!/bin/sh
bspc monitor -d I II III IV V VI VII VIII IX X
pgrep -x sxhkd > /dev/null || sxhkd &
bspc config border_width 2
bspc confug window_gap 12
bspc config split_ratio 0.52
bspc config bordeless_monocle true
bspc config gapless_monocle true
EOF
chmod +x /home/fifi/.config/bspwm/bspwmrc
'';
};
system.activationScripts.kitty = {
text = ‘’
cat > /home/fifi/.config/kitty/kitty.conf <<EOF
# BEGIN_KITTY_THEME
include current-theme.conf
confirm_os_window_close 2
dynamic_background_opacity yes
background_opacity 0.95
# END_KITTY_THEME
EOF
'';
};
system.activationScripts.sxhkd = {
text = ‘’
mkdir -p /home/fifi/.config/sxhkd
cat > /home/fifi/.config/sxhkd/sxhkdrc <<EOF
#
# wm independant hotkeys
#
# sxhkd setup
ctrl + super + alt + space
bspc monitor -d I II III IV V | pkill sxhkd && setxkbmap us && sleep 0.1 && sxhkd | polybar | picom | feh --bg-fill /home/fifi/.wallpapers/current-wallpaper.jpg | mkdir /home/fifi/.wallpapers
# switch keyboard layout
super + alt + Up
setxkbmap fr
super + alt + Down
setxkbmap us
# terminal emulator
super + Return
kitty
super + shift + Return
cool-retro-term
# program launcher
super + d
dmenu_run
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
#
# custom hotkeys
#
# open assortiment of tui controls
super + shift + d
kitty -e peaclock | kitty -e pulsemixer | kitty -e htop | kitty -e batmon | kitty -e bluetuith
# lockscreen
super + x
xlock
# file manager
super + a
kitty -e ranger
super + shift + a
thunar
# web browser
super + n
librewolf
super + shift + n
firefox
super + ctrl + shift + n
tor-browser
# calculator
super + k
kitty -e numbat
# localsend
super + e
localsend_app
# screen recorder
super + space
ksnip
super + shift + space
simplescreenrecorder
super + alt + space
gcolor2
#
# utility hotkeys
#
# switch keyboard layout
super + alt + Up
setxkbmap fr
super + alt + Down
setxkbmap us
# kill bloat processes
super + alt + enter
pkill spotify | pkill steam | pkill itch | pkill discord
# the function keys
super + F1
pamixer --toggle-mute
super + F2
pamixer -d 5
super + shift + F2
pamixer -d 10
super + F3
pamixer -i 5
super + shift + F3
pamixer -i 10
super + F4
kitty -e pulsemixer
super + shift + F4
kitty -e pulsemixer | kitty -e cava | spotify
super + F5
brightnessctl set 5%-
super + shift + F5
brightnessctl set 10%-
super + F6
brightnessctl set +5%
super + shift + F6
brightnesscl set +10%
super + F7
arandr
super + F8
kitty -e bluetuith
super + F9
#shortcut for theming
kitty -e vim ~/.config/polybar/config.ini | lxappearance | qt5ct | kitty -e ranger ~/.wallpapers | kitty -e kitten themes
super + F10
kitty -e nmtui
super + F11
kitty -e batmon
super + F12
kitty -e vim /etc/nixos/configuration.nix
#
# bspwm hotkeys
#
# close and kill
super + {_,shift + }w
bspc node -{c,k}
# alternate between the tiled and monocle layout
super + semicolon
bspc desktop -l next
# swap the current node and the biggest window
super + g
bspc node -s biggest.window
#
# state/flag
#
# set the window state
super + {t,shift + t,s,f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set the node flags
super + ctrl + {semicolon,x,y,z}
bspc node -g {marked,locked,sticky,private}
#
# focus/swap
#
# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the node in the given path jump
super + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous window in the current desktop
super + {_,shift + }c
bspc node -f {next,prev}.local.!hidden.window
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer mode in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1,2,3,4,5,6,7,8,9,0}
bspc {desktop -f,node -d} ^{1,2,3,4,5,6,7,8,9,10}
#
# preselect
#
# preselect the direction
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# cancel the preselection for the focused node
super + ctrl + space
bspc node -p cancel
# cancel the preselection for the focused desktop
super + ctrl + shift + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
#
# move/resize
#
# expand a window by moving one of its side outward
super + alt + {h,j,k,l}
bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# contract a window by moving one of its side inward
super + alt + shift + {h,j,k,l}
bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
EOF
chmod +x /home/fifi/.config/sxhkd/sxhkdrc
'';
};
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 NixOS Search).
system.stateVersion = “24.05”; # Did you read the comment?
}