diff options
| author | Hilton Chain <hako@ultrarare.space> | 2026-03-22 16:16:32 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2026-04-03 21:33:16 +0800 |
| commit | dd998ef19dbf3edbe7c8417e07a4d14b0975188b (patch) | |
| tree | d495d1f35898f8f6be8ffceb2ea0a9e86d89dc40 /README.org | |
| parent | 76819a836acdb151e452d93fa39d5011d048dfe4 (diff) | |
transformations: nvidia: Improve version selection support.
* nonguix/transformations.scm (nonguix-transformation-nvidia): Improve version
selection support.
* README.org (NVIDIA graphics card): Update documentation.
Diffstat (limited to 'README.org')
| -rw-r--r-- | README.org | 265 |
1 files changed, 206 insertions, 59 deletions
| @@ -223,130 +223,277 @@ firmware, and blacklisting of conflicting modules: | |||
| 223 | #+END_SRC | 223 | #+END_SRC |
| 224 | 224 | ||
| 225 | ** NVIDIA graphics card | 225 | ** NVIDIA graphics card |
| 226 | NVIDIA support in Nonguix is implemented with a few interfaces and packages: | 226 | Most NVIDIA GPUs are supported by the free [[https://nouveau.freedesktop.org/index.html][Nouveau driver]], as listed in |
| 227 | =nonguix-transformation-nvidia= for system setup, =replace-mesa= and =nvda= for | 227 | <https://nouveau.freedesktop.org/CodeNames.html>. No extra setup is required |
| 228 | application setup. | 228 | besides configuring =linux-firmware=. |
| 229 | 229 | ||
| 230 | *** System setup | 230 | Below are for the [[https://www.nvidia.com/en-us/drivers/][proprietary driver released by NVIDIA]]. Nonguix implements |
| 231 | Procedure =nonguix-transformation-nvidia= is defined in the | 231 | support via the following interfaces: |
| 232 | =(nonguix transformations)= module. | 232 | |
| 233 | - User-facing driver packages: =nvda=, defined in =(nongnu packages nvidia)= | ||
| 234 | - Application setup: the [[https://guix.gnu.org/manual/devel/en/html_node/Security-Updates.html][grafting]] mechanism and =replace-mesa=, defined in | ||
| 235 | =(nongnu packages nvidia)= | ||
| 236 | - System setup: =nonguix-transformation-nvidia=, defined in | ||
| 237 | =(nonguix transformations)= | ||
| 238 | |||
| 239 | We'll cover them later. First of all, let's choose the driver and kernel | ||
| 240 | version to use. | ||
| 241 | |||
| 242 | Here're GPUs supported by our packaged proprietary drivers. | ||
| 243 | |||
| 244 | | Code name | Series | nvda-beta | nvda-590 | nvda-580 | nvda-470 | nvda-390 | Nouveau | | ||
| 245 | |--------------+------------------------------------+-----------+----------+----------+----------+----------+---------| | ||
| 246 | | [[https://en.wikipedia.org/wiki/Blackwell_(microarchitecture)][Blackwell]] | GeForce 50 series | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | | ||
| 247 | | [[https://en.wikipedia.org/wiki/Ada_Lovelace_(microarchitecture)][Ada Lovelace]] | GeForce 40 series | ✅ | ✅ | ✅ | ❌ | ❌ | ✅ | | ||
| 248 | | [[https://en.wikipedia.org/wiki/Ampere_(microarchitecture)][Ampere]] | GeForce 30 series | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | | ||
| 249 | | [[https://en.wikipedia.org/wiki/Turing_(microarchitecture)][Turing]] | GeForce 16/20 series | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ | | ||
| 250 | | [[https://en.wikipedia.org/wiki/Volta_(microarchitecture)][Volta]] | Titan V | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | | ||
| 251 | | [[https://en.wikipedia.org/wiki/Pascal_(microarchitecture)][Pascal]] | GeForce 10 series | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | | ||
| 252 | | [[https://en.wikipedia.org/wiki/Pascal_(microarchitecture)][Maxwell]] | GeForce 750/900 | ❌ | ❌ | ✅ | ✅ | ✅ | ✅ | | ||
| 253 | | [[https://en.wikipedia.org/wiki/Kepler_(microarchitecture)][Kepler]] | GeForce 600/700, GeForce GTX Titan | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | | ||
| 254 | | [[https://en.wikipedia.org/wiki/Fermi_(microarchitecture)][Fermi]] | GeForce 400/500 | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | | ||
| 255 | |||
| 256 | *NOTE*: Open source kernel modules are supported since Turing and required since | ||
| 257 | Blackwell. Wayland support for =nvda-470= and =nvda-390= is only available on | ||
| 258 | GNOME desktop environment. | ||
| 259 | |||
| 260 | Per-driver supported kernel versions, let us know if you have hardware to test! | ||
| 261 | The sign ⚠️ means open source kernel modules don't work but close source ones do. | ||
| 262 | |||
| 263 | | Driver | linux-6.19 | linux-6.18 | linux-6.12 | linux-6.6 | linux-6.1 | | ||
| 264 | |-----------+------------+------------+------------+-----------+-----------| | ||
| 265 | | nvda-beta | ⚠️ | ⚠️ | ✅ | ✅ | ✅ | | ||
| 266 | | nvda-590 | ⚠️ | ✅ | ✅ | ✅ | ✅ | | ||
| 267 | | nvda-580 | ✅ | ⚠️ | ✅ | ✅ | ✅ | | ||
| 268 | | nvda-470 | ✅ | ✅ | ✅ | ✅ | ✅ | | ||
| 269 | | nvda-390 | | | | | | | ||
| 270 | |||
| 271 | Driver package specifications, for command-line interface usage. | ||
| 272 | |||
| 273 | | Driver | Specification | | ||
| 274 | |-----------+---------------| | ||
| 275 | | nvda-beta | nvda-beta | | ||
| 276 | | nvda-590 | nvda@590 | | ||
| 277 | | nvda-580 | nvda@580 | | ||
| 278 | | nvda-470 | nvda@470 | | ||
| 279 | | nvda-390 | nvda@390 | | ||
| 280 | |||
| 281 | *** Configure operating system for NVIDIA proprietary driver | ||
| 282 | System setup is implemented via =nonguix-transformation-nvidia=: | ||
| 233 | 283 | ||
| 234 | #+begin_example | 284 | #+begin_example |
| 235 | nonguix-transformation-nvidia [#:driver nvda] | 285 | nonguix-transformation-nvidia [#:driver nvda-580] |
| 236 | [#:open-source-kernel-module? #f] | 286 | [#:open-source-kernel-module? #false] |
| 237 | [#:kernel-mode-setting? #t] | 287 | [#:kernel-mode-setting? #true] |
| 238 | [#:configure-xorg? #f] | 288 | [#:configure-xorg? #false] |
| 239 | 289 | ||
| 240 | Return a procedure that transforms an operating system, setting up | 290 | Return a procedure that transforms an operating system, setting up DRIVER |
| 241 | DRIVER (default: nvda) for NVIDIA graphics card. | 291 | (default: nvda-580) for NVIDIA GPU. |
| 242 | 292 | ||
| 243 | OPEN-SOURCE-KERNEL-MODULE? (default: #f) only supports Turing and later | 293 | OPEN-SOURCE-KERNEL-MODULE? (default: #f) is supported since Turing and required |
| 244 | architectures and is expected to work with 'linux-lts'. | 294 | since Blackwell. |
| 245 | 295 | ||
| 246 | KERNEL-MODE-SETTING? (default: #t) is required for Wayland and rootless Xorg | 296 | KERNEL-MODE-SETTING? (default: #t) is required for Wayland and rootless Xorg |
| 247 | support. | 297 | support. |
| 248 | 298 | ||
| 249 | CONFIGURE-XORG? (default: #f) is required for Xorg display managers. When | 299 | CONFIGURE-XORG? (default: #f) is required for Xorg display managers. It accepts |
| 250 | setting to #t, it configures the one specified by '%desktop-services'. If you | 300 | a display manager service type, or #t when using '%desktop-services'. |
| 251 | set up the display manager on your own, use its service type instead, | ||
| 252 | 'sddm-service-type', for example. | ||
| 253 | |||
| 254 | Use 'replace-mesa', for application setup out of the operating system | ||
| 255 | declaration. | ||
| 256 | #+end_example | 301 | #+end_example |
| 257 | 302 | ||
| 258 | For example, assuming the follow operating system declaration, defined as | 303 | For example, assuming the following operating system declaration, defined as |
| 259 | variable =%my-os=: | 304 | variable =%my-os=: |
| 260 | 305 | ||
| 261 | #+BEGIN_SRC scheme | 306 | #+BEGIN_SRC scheme |
| 262 | (use-modules (nonguix transformations)) | ||
| 263 | |||
| 264 | (define %my-os | 307 | (define %my-os |
| 265 | (operating-system ...)) | 308 | (operating-system <...>)) |
| 266 | #+END_SRC | 309 | #+END_SRC |
| 267 | 310 | ||
| 268 | - Headless environmnet: disable =#:kernel-mode-setting?=: | 311 | - Headless environment |
| 312 | |||
| 313 | Disable =#:kernel-mode-setting?=. | ||
| 269 | 314 | ||
| 270 | #+begin_src scheme | 315 | #+begin_src scheme |
| 271 | ((nonguix-transformation-nvidia #:kernel-mode-setting? #f) | 316 | ((nonguix-transformation-nvidia |
| 317 | #:driver nvda-580 | ||
| 318 | #:kernel-mode-setting? #f) | ||
| 272 | %my-os) | 319 | %my-os) |
| 273 | #+end_src | 320 | #+end_src |
| 274 | 321 | ||
| 275 | - Pure-Wayland environmnet: no argument required: | 322 | - Xorg environment |
| 323 | |||
| 324 | When using =%desktop-services=, enable =#:configure-xorg?=. | ||
| 276 | 325 | ||
| 277 | #+begin_src scheme | 326 | #+begin_src scheme |
| 278 | ((nonguix-transformation-nvidia) | 327 | ((nonguix-transformation-nvidia |
| 328 | #:driver nvda-580 | ||
| 329 | #:configure-xorg? #t) | ||
| 279 | %my-os) | 330 | %my-os) |
| 280 | #+end_src | 331 | #+end_src |
| 281 | 332 | ||
| 282 | - Xorg environmnet: =#:configure-xorg?=: | 333 | When using a custom display manager, set =#:configure-xorg?= to its service |
| 283 | 334 | type, SDDM for example. | |
| 284 | Set to =#t= when you're using =%desktop-services=. | ||
| 285 | 335 | ||
| 286 | #+begin_src scheme | 336 | #+begin_src scheme |
| 287 | ((nonguix-transformation-nvidia #:configure-xorg? #t) | 337 | ((nonguix-transformation-nvidia |
| 338 | #:driver nvda-580 | ||
| 339 | #:configure-xorg? sddm-service-type) | ||
| 288 | %my-os) | 340 | %my-os) |
| 289 | #+end_src | 341 | #+end_src |
| 290 | 342 | ||
| 291 | Specify service type of your display manager otherwine. | 343 | - Pure-Wayland environment and not using an X display manager: no extra argument |
| 344 | required. | ||
| 292 | 345 | ||
| 293 | #+begin_src scheme | 346 | #+begin_src scheme |
| 294 | ((nonguix-transformation-nvidia #:configure-xorg? sddm-service-type) | 347 | ((nonguix-transformation-nvidia #:driver nvda-580) |
| 295 | %my-os) | 348 | %my-os) |
| 296 | #+end_src | 349 | #+end_src |
| 297 | 350 | ||
| 298 | Full example below, using =compose= so that other system transformations can be | 351 | Full example below: |
| 299 | mixed in: | ||
| 300 | 352 | ||
| 301 | #+begin_src scheme | 353 | #+begin_src scheme |
| 302 | (use-modules (nonguix transformations) ...) | 354 | (use-modules (nonguix transformations) |
| 355 | (nongnu packages linux) | ||
| 356 | (nongnu packages nvidia) | ||
| 357 | <...>) | ||
| 303 | 358 | ||
| 304 | (define %my-os | 359 | (define %my-os |
| 305 | (operating-system ...)) | 360 | (operating-system |
| 361 | (kernel linux-6.12) | ||
| 362 | (firmware (cons* linux-firmware %base-firmware)) | ||
| 363 | <...>)) | ||
| 364 | |||
| 365 | ((nonguix-transformation-nvidia | ||
| 366 | #:driver nvda-580 | ||
| 367 | #:configure-xorg? #t) | ||
| 368 | %my-os) | ||
| 369 | #+end_src | ||
| 370 | |||
| 371 | *NOTE*: [[https://guix.gnu.org/manual/devel/en/html_node/Desktop-Services.html][%desktop-services]] includes GNOME Display Manager (GDM) on 64-bit | ||
| 372 | systems, which has known issues when working with the NVIDIA proprietary driver: | ||
| 373 | |||
| 374 | - Unable to launch Wayland sessions. | ||
| 375 | - Blank screen on switchable graphics setup. | ||
| 376 | |||
| 377 | As a result, it's recommended to use another display manager instead. | ||
| 378 | |||
| 379 | Here's example to [[https://guix.gnu.org/manual/devel/en/html_node/Service-Reference.html#index-modify_002dservices-1][modify]] =%desktop-services= and replace GDM with [[https://guix.gnu.org/manual/devel/en/html_node/X-Window.html#index-sddm_002dservice_002dtype][SDDM display | ||
| 380 | manager]] (=sddm-service-type=, defined in =(gnu services sddm)=). | ||
| 381 | |||
| 382 | #+begin_src scheme | ||
| 383 | (use-modules (nonguix transformations) | ||
| 384 | (gnu services sddm) | ||
| 385 | (gnu services xorg) | ||
| 386 | (nongnu packages linux) | ||
| 387 | (nongnu packages nvidia) | ||
| 388 | <...>) | ||
| 306 | 389 | ||
| 307 | ((compose (nonguix-transformation-nvidia)) | 390 | (define %my-os |
| 391 | (operating-system | ||
| 392 | (kernel linux-6.12) | ||
| 393 | (firmware (cons* linux-firmware %base-firmware)) | ||
| 394 | (services | ||
| 395 | (cons* <...> | ||
| 396 | (service sddm-service-type) | ||
| 397 | (modify-services %desktop-services | ||
| 398 | (delete gdm-service-type)))) | ||
| 399 | <...>)) | ||
| 400 | |||
| 401 | ((nonguix-transformation-nvidia | ||
| 402 | #:driver nvda-580 | ||
| 403 | #:configure-xorg? sddm-service-type) | ||
| 308 | %my-os) | 404 | %my-os) |
| 309 | #+end_src | 405 | #+end_src |
| 310 | 406 | ||
| 311 | *** Application setup | 407 | When using [[https://guix.gnu.org/manual/devel/en/html_node/X-Window.html#index-set_002dxorg_002dconfiguration-1][set-xorg-configuration]], also replace the following |
| 408 | |||
| 409 | #+begin_src scheme | ||
| 410 | (set-xorg-configuration | ||
| 411 | (xorg-configuration | ||
| 412 | (keyboard-layout <...>))) | ||
| 413 | #+end_src | ||
| 414 | |||
| 415 | to | ||
| 416 | |||
| 417 | #+begin_src scheme | ||
| 418 | (set-xorg-configuration | ||
| 419 | (xorg-configuration | ||
| 420 | (keyboard-layout <...>)) | ||
| 421 | sddm-service-type) | ||
| 422 | #+end_src | ||
| 423 | |||
| 424 | *** Configure applications for NVIDIA proprietary driver | ||
| 312 | Application setup involves replacing the underlying graphics library from =mesa= | 425 | Application setup involves replacing the underlying graphics library from =mesa= |
| 313 | to =nvda=. Within an operating system declaration, it's handled by | 426 | to =nvda=. Within an operating system declaration, it's handled by |
| 314 | =nonguix-transformation-nvidia=. In other cases we'll use the [[https://guix.gnu.org/manual/devel/en/html_node/Security-Updates.html][grafts]] mechanism | 427 | =nonguix-transformation-nvidia=, and we'll use the [[https://guix.gnu.org/manual/devel/en/html_node/Security-Updates.html][grafting]] mechanism explictly |
| 315 | explictly. | 428 | otherwise. |
| 316 | 429 | ||
| 317 | In Guix command-line interface, we can use the =--with-graft== [[https://guix.gnu.org/manual/devel/en/guix.html#Package-Transformation-Options][package | 430 | On the Guix command-line interface, we can use the =--with-graft== [[https://guix.gnu.org/manual/devel/en/guix.html#Package-Transformation-Options][package |
| 318 | transformation option]]. | 431 | transformation option]]. |
| 319 | 432 | ||
| 320 | For example, spawning a one-off software environmnet with =guix shell=: | 433 | For example, spawning one-off software environment with ~guix shell~: |
| 321 | 434 | ||
| 322 | #+BEGIN_SRC shell | 435 | #+BEGIN_SRC shell |
| 323 | guix shell mesa-utils nvda --with-graft=mesa=nvda -- glxinfo | 436 | $ guix shell mesa-utils nvda@580 --with-graft=mesa=nvda@580 -- glxinfo |
| 324 | #+END_SRC | 437 | #+END_SRC |
| 325 | 438 | ||
| 326 | Note that =nvda= is added into the shell, it's for [[https://guix.gnu.org/manual/devel/en/html_node/Search-Paths.html][search paths]]. | 439 | *NOTE*: =nvda= is added into the shell for [[https://guix.gnu.org/manual/devel/en/html_node/Search-Paths.html][search paths]]. |
| 327 | 440 | ||
| 328 | A programmatical approach is provided by procedure =(replace-mesa)= defined in | 441 | =replace-mesa= provides a programmatical approach. It applies on any object |
| 329 | =(nongnu packages nvidia)= module. It can be applied onto any object: | 442 | recursively and is used by =nonguix-transformation-nvidia= internally. |
| 330 | 443 | ||
| 331 | #+BEGIN_SRC scheme | 444 | #+BEGIN_SRC scheme |
| 332 | (use-modules (nongnu packages nvidia)) | 445 | (use-modules (nongnu packages nvidia)) |
| 333 | 446 | ||
| 334 | (replace-mesa <any-object>) | 447 | (replace-mesa <...> #:driver nvda-580) |
| 335 | #+END_SRC | 448 | #+END_SRC |
| 336 | 449 | ||
| 337 | Additional note for PRIME render offload on switchable graphics setup: launch | 450 | On switchable graphics setup, =nvidia-prime= package provides a ~prime-run~ |
| 338 | graphical applications with environment variables | 451 | script to run application on the NVIDIA GPU via PRIME render offload. |
| 339 | =__NV_PRIME_RENDER_OFFLOAD=1= and =__GLX_VENDOR_LIBRARY_NAME=nvidia=. | ||
| 340 | 452 | ||
| 341 | *** Package variants | 453 | #+begin_src shell |
| 342 | A few packages require extra effort to support and they're implemented as | 454 | $ prime-run steam |
| 455 | #+end_src | ||
| 456 | |||
| 457 | *** Package variants for NVIDIA proprietary driver | ||
| 458 | Some packages require extra support to use the driver and they're implemented as | ||
| 343 | package variants. When you need one of them, install the variant below instead | 459 | package variants. When you need one of them, install the variant below instead |
| 344 | of the normal one. Application setup is still necessary. | 460 | of the normal one. Aforementioned application setup is still necessary. |
| 345 | 461 | ||
| 346 | - heroic-nvidia | ||
| 347 | - mpv-nvidia | 462 | - mpv-nvidia |
| 348 | - obs-nvidia | 463 | - obs-nvidia |
| 349 | - steam-nvidia | 464 | |
| 465 | Container packages must be built for the specific driver version, so they have | ||
| 466 | more variants: | ||
| 467 | |||
| 468 | | Variable | Specification | | ||
| 469 | |--------------------+--------------------| | ||
| 470 | | heroic-nvidia-beta | heroic-nvidia-beta | | ||
| 471 | | heroic-nvidia-590 | heroic-nvidia@590 | | ||
| 472 | | heroic-nvidia-580 | heroic-nvidia@580 | | ||
| 473 | | heroic-nvidia-470 | heroic-nvidia@470 | | ||
| 474 | | heroic-nvidia-390 | heroic-nvidia@390 | | ||
| 475 | |||
| 476 | | Variable | Specification | | ||
| 477 | |-------------------+-------------------| | ||
| 478 | | steam-nvidia-beta | steam-nvidia-beta | | ||
| 479 | | steam-nvidia-590 | steam-nvidia@590 | | ||
| 480 | | steam-nvidia-580 | steam-nvidia@580 | | ||
| 481 | | steam-nvidia-470 | steam-nvidia@470 | | ||
| 482 | | steam-nvidia-390 | steam-nvidia@390 | | ||
| 483 | |||
| 484 | Since ffmpeg has multiple versions itself already, its variants are only | ||
| 485 | available to the programming interface: | ||
| 486 | |||
| 487 | - ffmpeg/nvidia-390 | ||
| 488 | - ffmpeg/nvidia-470 | ||
| 489 | - ffmpeg/nvidia-580 | ||
| 490 | - ffmpeg/nvidia-590 | ||
| 491 | - ffmpeg/nvidia-beta | ||
| 492 | - ffmpeg-6/nvidia-390 | ||
| 493 | - ffmpeg-6/nvidia-470 | ||
| 494 | - ffmpeg-6/nvidia-580 | ||
| 495 | - ffmpeg-6/nvidia-590 | ||
| 496 | - ffmpeg-6/nvidia-beta | ||
| 350 | 497 | ||
| 351 | ** Substitutes for nonguix | 498 | ** Substitutes for nonguix |
| 352 | 499 | ||
