Dell provides a debian package which we can extract a binary and shared object files to create a derivation.
The problem: the runtime accesses a file at /usr/lib/ext/dell/omreg.cfg.
I could create a NixOS module with a one-shot systemd service to create this file, but as omreg.cfg is provided in the debian package this doesn’t seem like the ideal solution.
The absolute path to this file is contained in some of the shared object files:
Unfortunately I can’t upstream this to nixpkgs because it uses rahpi’s fork of patchelf, but you can use it from my flake nix shell github:RyanGibb/nixos/ccbf20f\#cctk.
Do you think you would consider upstreaming your fork of patchelf @raphi?
It seems like this the issue is while LD_PRELOAD can replace shared libraries, it doesn’t propitiate to replacing shared libraries (our wrapper/libredirect) of shared libraries (cctk’s dependencies)…
That’s super cool! I can already see how it could prove useful to patch programs that expect configuration to be written in the same folder as the executable (read-only in nix). This way we can even patch the function the check some XDG environment variable to let each user have their own configuration.
Actually, I was thinking that when patching the library is not possible (for instance because there is not even a library as the file is static), it may be possible to modify the syscall using ptrace… even if I’m not an expert and I don’t know if it’s possible to easily “override” a single library this way. Hopefully the number of times where such hack is needed is quite small.