I’m a NixOS novice, and have successfully setup a working continuous integration agent! It’s nice.
I unfortunately have chosen to build my video games using Unity and it requires, according the docs, to read the file /usr/share/unity3d/config/services-config.json in order to use the “pro license” features.
Right now I’m running unpatched Unity executables with the help of nix-ld, they work great and produce a working Unity build-- however I have no idea what I should do to make the license file temporarily (or permanently) available at /usr/share/unity3d/config/ in a NixOS way.
is very close to what I need. Though perhaps more symlinky rather than actually storing the data at /usr/share/unity haha. I’ve been reading and experimenting quite a bit and I’m struggling to make progress. Thank you for your time!
There’s no clean way to do this with existing NixOS modules. The usual workaround is tmpfiles.d, or a systemd unit. You can also use activationScripts, but I recommend systemd units instead whenever possible as they will have clear logs when activationScripts do not.
I’d suggest:
Check if this is actually a requirement or if you can change the path using $XDG_DATA_HOME or such, lots of proprietary applications actually support alternative paths but don’t document it.
tmpfiles.d can’t handle newlines for contents, hence this might not be an option.
If the file has newlines and faking an fhs env through bubblewrap is not an option you’ll probably have to bite the bullet and use a systemd service to create the path on boot:
Thank you so much for the quick and informative response!
Check if this is actually a requirement or if you can change the path using $XDG_DATA_HOME or such, lots of proprietary applications actually support alternative paths but don’t document it.
I did try putting the license file in ~/.local/share/unity3d/config, unfortunately this didn’t work and I’m not enough of a sleuth to know of other things to try.
Consider using buildFhsUserEnv over nix-ld.
I think this would work, however setting up the bubble wrap to only execute on my NixOS machines would require a fork in the build process that I’m afraid will introduce me to new misunderstandings.
If the file has no newlines:
This worked fantastic, json doesn’t require new lines so I just removed them all. I specifically added this bit of code to my nix config: