Equivalent to `hardware.graphics.enable = true` through Nix Package Manager

Hello all

I’m hitting a wall trying to leverage the Nix package manager on a Debian based render farm.

I tried:

  • Multi-user installation (recommended)
  • Single-user installation

both giving me the exact same result.

I’m exposing a (un-patched) Blender binary wrapped in buildFHSenv (bwrap) through a Flake app output:

├───apps
│   └───x86_64-linux
│       ├───[...]
│       └───blender-4-4-3-app: app: Launch Blender 4.4.3
├───devShells
│   └───x86_64-linux
│       ├───[...]
│       └───blender-4-4-3-devshell: development environment 'blender-4-4-3-devshell'
└───packages
    └───x86_64-linux
        ├───[...]
        └───blender-4-4-3-package: package 'blender-4-4-3-package'

This seems to work very well (as a proof of concept) - also for other (mostly proprietary) DCC software packages.

However, this approach stops being functional as soon as I run the Flake on a non NixOS platform where only the Nix package manager is installed. I verified this behavior on

  • Ubuntu 24 as a VirtualBox VM
  • Inside a --privileged Docker Container running from a docker.io/debian:bullseye-slim image (I am aware that this is pretty dated, however, the render workers are based on this image as of now and the environment itself is working)

And here is where and how the Flake (with the Blender --background process) fails:

[...]
2026-12-01 00:56:53:  0: STDOUT: EGL Error (0x300C): EGL_BAD_PARAMETER: One or more argument values are invalid.
2026-12-01 00:56:53:  0: STDOUT: EGL Error (0x300C): EGL_BAD_PARAMETER: One or more argument values are invalid.
2026-12-01 00:56:53:  0: STDOUT: EGL Error (0x300C): EGL_BAD_PARAMETER: One or more argument values are invalid.
2026-12-01 00:56:53:  0: STDOUT: EGL Error (0x300C): EGL_BAD_PARAMETER: One or more argument values are invalid.
2026-12-01 00:56:53:  0: STDOUT: blender: ../external_epoxy/src/dispatch_common.c:872: epoxy_get_proc_address: Assertion `0 && "Couldn't find current GLX or EGL context.\n"' failed.
2026-12-01 00:56:57:  0: INFO: Process returned: 134

Further investigation lead to the following underlying dependency issue that I don’t know how I would resolve that with my very limited experience in the Nix ecosystem.

When running the Flake output on native NixOS, I’m getting the exact same error messages, unless I set

{
  hardware.graphics.enable = true;
}

in /etc/nixos/configuration.nix (ref).

So, how would I have to go about resolving this on a non NixOS host where the Debian based host itself has the underlying dependencies to successfully execute the Blender --background render task?

Thanks for your help!

Cheers,
Michael

50/50 if it works but try this.

I’m going to give it a shot! I’ll come back with the results! Thanks @waffle8946

I prefer this:

It’s cleaner, IMO. Requires keeping your Nix driver version in sync with your host machine, but it actually creates the /run/opengl-driver/ paths instead of hackily wrapping the program.

There is also this home manager option: GPU on non-NixOS systems - Home Manager Manual

Similar to the nix-system-graphics approach aboves, it creates the /run paths instead of wrapping an individual program. The advantage of type of setup is that it means that programs from nix-shell and nix shell will benefit from GPU acceleration as well.

Another thing to consider is trying to force Vulkan. I have done some testing, and I have gotten Vulkan to work without wrapping the program, for things like llama.cpp or stable diffusion, on non NixOS distros.

Thanks @bitbloxhub. A non wrapper solution would definitely be preferred so I gave this a try. The host is not equipped with Nvidia GPUs, so, keeping driver versions in sync is not something I have to mess with at this stage.

This is my nix-system-graphics/flake.nix (I explicitly set release to 26.05):

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";

    system-manager = {
      url = "github:numtide/system-manager/release-26.05";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nix-system-graphics = {
      url = "github:soupglasses/nix-system-graphics";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, flake-utils, nixpkgs, system-manager, nix-system-graphics }: {
    systemConfigs.default = system-manager.lib.makeSystemConfig {
      modules = [
        nix-system-graphics.systemModules.default
        ({
          config = {
            nixpkgs.hostPlatform = "x86_64-linux";
            system-manager.allowAnyDistro = true;
            system-graphics.enable = true;
          };
        })
      ];
    };
  };
}

I’m not quite there yet. This is my current process, maybe you can spot a flaw there:

docker run \
    -it \
    --rm \
    --privileged \
    -e "RUST_BACKTRACE=full" \
    -e "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket" \
    --volume "/run/dbus/system_bus_socket:/run/dbus/system_bus_socket" \
    docker.io/debian:bullseye-slim

# All commands inside the container from here on...

echo 'deb http://archive.debian.org/debian bullseye main' >> /etc/apt/sources.list
echo 'deb http://archive.debian.org/debian-security bullseye-security main' >> /etc/apt/sources.list
echo 'deb http://archive.debian.org/debian bullseye-updates main' >> /etc/apt/sources.list

apt -y update \
    && apt -y install \
        curl \
        xz-utils \
        dbus \
        dbus-x11

curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install | sh -s -- --daemon \
    && exec $SHELL
# ---- Reminders -----------------------------------------------------------------
# [ 1 ]
# Nix won't work in active shell sessions until you restart them.
# 
# [ 2 ]
# I don't support your init system yet; you may want to add nix-daemon manually.
# 
# ==> IS [ 2 ] SOMETHING I HAVE TO DO?

# $ nix-shell -p nix-info --run "nix-info -m"
#  - system: `"x86_64-linux"`
#  - host os: `Linux 7.3.4, Debian GNU/Linux, 11 (bullseye), nobuild`
#  - multi-user?: `yes`
#  - sandbox: `yes`
#  - version: `nix-env (Nix) 2.36.0`
#  - channels(root): `"nixpkgs"`
#  - nixpkgs: `/nix/store/4d96ap55a2jcdyafqxmjbc4l779lrq6s-nixpkgs/nixpkgs`

echo "experimental-features = nix-command flakes" >> /etc/nix/nix.conf
echo "extra-substituters = https://cache.numtide.com" >> /etc/nix/nix.conf
echo "extra-trusted-public-keys = niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=" >> /etc/nix/nix.conf

nix run 'github:numtide/system-manager' -- switch --flake github:michimussato/flake-prod?dir=nix-system-graphics
# Although I added lines to /etc/nix/nix.conf, I'm still being asked:
# do you want to allow configuration setting 'extra-substituters' to be set to 'https://cache.numtide.com' (y/N)? y
# do you want to permanently mark this value as trusted (y/N)? y
# do you want to allow configuration setting 'extra-trusted-public-keys' to be set to 'niks3.numtide.com-1:DTx8wZduET09hRmMtKdQDxNNthLQETkc/yaX7M4qK0g=' (y/N)? y
# do you want to permanently mark this value as trusted (y/N)? y

Which currently fails with (with -e "RUST_BACKTRACE=full"):

[...]

All pre-activation assertions succeeded.
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate] Activating etc files...
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate::etc_files] Reading etc file definitions...
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate::etc_files] Creating /etc entries in /etc
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate] Restarting sysinit-reactivation.target...
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate::services] Reloading the systemd daemon...
[2026-12-02T09:31:45Z INFO  system_manager_engine::systemd] Waiting for jobs to finish...
[2026-12-02T09:31:45Z INFO  system_manager_engine::systemd] All jobs finished.
[2026-12-02T09:31:45Z INFO  system_manager_engine::activate] Activating tmp files...

thread 'main' (9205) panicked at crates/system-manager-engine/src/activate/tmp_files.rs:32:10:
Error forking process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0:     0x5ad013a55b3c - <<std[e114a732dcca3553]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[3450ada48eaa0180]::fmt::Display>::fmt
   1:     0x5ad0139924ea - core[3450ada48eaa0180]::fmt::write
   2:     0x5ad013a81115 - <std[e114a732dcca3553]::sys::stdio::unix::Stderr as std[e114a732dcca3553]::io::Write>::write_fmt
   3:     0x5ad013a55877 - std[e114a732dcca3553]::panicking::panic_with_hook
   4:     0x5ad013a56167 - std[e114a732dcca3553]::panicking::panic_handler::{closure#0}
   5:     0x5ad013a56119 - std[e114a732dcca3553]::sys::backtrace::__rust_end_short_backtrace::<std[e114a732dcca3553]::panicking::panic_handler::{closure#0}, !>
   6:     0x5ad013a565ec - __rustc[d8ff9d08a1174409]::rust_begin_unwind
   7:     0x5ad013916a8b - core[3450ada48eaa0180]::panicking::panic_fmt
   8:     0x5ad0139168d1 - core[3450ada48eaa0180]::result::unwrap_failed
   9:     0x5ad013ac209c - system_manager_engine::activate::activate::had41490bb986744b
  10:     0x5ad01390fd2a - system_manager_engine::main::h36ff4d4ce117f07f
  11:     0x5ad01392da16 - std::sys::backtrace::__rust_begin_short_backtrace::h1dac3bbc2dc428b7
  12:     0x5ad01392ee8c - main
  13:     0x735d5664b285 - __libc_start_call_main
  14:     0x735d5664b338 - __libc_start_main@GLIBC_2.2.5
  15:     0x5ad01392a495 - _start
  16:                0x0 - <unknown>
[2026-12-02T09:31:45Z ERROR system_manager] Engine command exited with status unknown
    
    Stack backtrace:
       0: <anyhow::Error>::msg::<alloc::string::String>
       1: system_manager::invoke_engine
       2: system_manager::invoke_engine_activate
       3: system_manager::main
       4: std::sys::backtrace::__rust_begin_short_backtrace::<fn() -> std::process::ExitCode, std::process::ExitCode>
       5: main
       6: __libc_start_call_main
       7: __libc_start_main@@GLIBC_2.34
       8: _start
root@1b07286cebe2:/#

What am I missing? Apologies, I’m not familiar with Rust debugging. This only thing I can spot here is a potential GLIBC_2.34 issue.


Edit:

I just tried with docker.io/debian:trixie with the same result.

Is it a problem that the only user on the system is root?

Thanks for pointing out that Home Manager option, @moonpiedumplings. I’ll give it a shot.

Out of curiousity, re Vulkan: I currently have to get OpenGL to work but it might be interesting for future internal tooling… are you saying that, when using the Vulkan backend, no extra tools like the ones mentioned in this thread are required?

I just tried on an Ubuntu 24.04 virtual machine:

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 7.0.0-44-generic, Ubuntu, 24.04.5 LTS (Noble Numbat), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.36.0`
 - channels(root): `"nixpkgs"`
 - nixpkgs: `/nix/store/4d96ap55a2jcdyafqxmjbc4l779lrq6s-nixpkgs/nixpkgs`

and I get the following problem

$ nix run 'github:numtide/system-manager' -- switch --flake github:michimussatoflake-prod?dir=nix-system-graphics
[...]
[2026-12-02T12:39:33Z INFO  system_manager_engine::register] Built system-manager profile /nix/store/gnvr3hc5lr28pbif56lplr8016bdn5s3-system-manager
[2026-12-02T12:39:33Z INFO  system_manager_engine::register] Creating new generation from /nix/store/gnvr3hc5lr28pbif56lplr8016bdn5s3-system-manager
[2026-12-02T12:39:33Z ERROR system_manager_engine] While creating the profile dir.
    
    Caused by:
        Permission denied (os error 13)

How is that I get a permission issue after successfull installing Nix Multi-User?


Edit:

Just found the --sudo flag in system-manager/README.md at main · numtide/system-manager · GitHub which fixes the permission issue.

Also

nix shell 'nixpkgs#mesa-demos' --command glxgears

is giving me the expected result with this setup.

Furthermore, on a headless system, the command is also giving me the expected result:

nix shell 'nixpkgs#mesa-demos' 'nixpkgs#xvfb-run' --command xvfb-run glxgears

Ah, I forgot that only Nvidia is as picky about this.

So, this isn’t actually an issue just for running Nix, but for system-manager, it actually is, because system-manager needs the host to run systemd. Instead of making the container run systemd, though, here are some other solutions that may be cleaner (I don’t know much about running graphics stuff in containers, so take these with a grain of salt):