I’m not sure if this has been discussed before, but I am of the opinion that OpenGL and Vulkan should not be treated like libraries. On the surface, OpenGL/EGL and Vulkan are dynamically linked libraries. However, I would argue that they are actually protocols, that just happen to involve dynamically loading a library.
Now, just to be clear, I am tackling this from the perspective of someone using NixOS as a daily driver, I don’t have much experience with NixOS on the deployment end.
Nix does a really good job at taking dynamically linked libraries and allowing some apps to be updated to the latest version while keeping others on older versions for compatibility reasons. This is really nice as a developer and as a system manager so that I don’t have to worry about the “It works on my machine” problem (as much). However, this is not the case for EGL/Vulkan, and never will be.
EGL and Vulkan are not a library that you target. They are an interface to load the GPU drivers. Even if the version of EGL and Vulkan are the same across a set of computers, you have no guarantee that GPU drivers will be the same. Different drivers have different extensions and different bugs, and none of this is something that nix can hope to wrangle without forcing programs to target specific hardware. On the flipside, this is something that graphics programmers are well aware of and are prepared to work around.
What they can’t work around is EGL or Vulkan simply not being there.
You see, while most Linux programs use dynamically linked libraries, not all Linux programs do. I myself prefer to make statically linked programs, therefore guaranteeing that the code I ship doesn’t have it dependencies shifting underneath it, similar to the benefits Nix brings by hashing its inputs. Ideally, the programs I write should be able to run anywhere, because it is simply x86_64 machine code adhering to some stable interfaces: the syscall interface of the Linux kernel, the Wayland protocol, and the EGL/Vulkan libraries. As long as these interfaces keep their promises, my app should be able to run.
NixOS breaks the promises of the EGL and Vulkan interfaces. It hides these libraries from executables unless the user goes through extra effort to unhide them. While this may be desirable to prevent random libraries updates from breaking everything, EGL and Vulkan are standardized. And if you think that interfaces shouldn’t be exposed by default, you must explain why it is okay for Linux syscalls and Wayland unix domain sockets to be exposed by default, but not EGL and Vulkan. Just because EGL and Vulkan happens to use an ELF DLL doesn’t mean that they aren’t interfaces.
Anyway, that’s my rant. Do you agree or disagree? Do you think my hopes of releasing statically linked programs that run on most Linux distros are misguided or unrealistic? Or do you think I should find a different distro, since I don’t want to package everything into the one true packaging language, Nix?
P.S. not trying to be spicy but this has been simmering for a bit.