Last year I wanted to make flatpak use a different partition. Some searches (and reading the docs) later, I decided to use /etc/flatpak/installations.d/ to add an extra location. I set up environment.etc to create the file, but flatpak ignored me. After some futzing around I eventually ran strace and realised that it was searching the nix store, and not /etc. So I wrote an overlay to have it create the file during build so it existed in the store.
Being able to recognize that NixOS may be looking at an unconventional location was what allowed me to make that work.