I’m sure someone here has faced the following scenario:
Independently of NixOS, some things to do to address this more or less reliably:
- add versioning query arguments to the script tags, e.g.
"main.js?<hash (of main.js, or full output, or git checkout)>"
- add versioning to the path, e.g.
- do things to web server caching headers
(I may well be missing the right solutions here – not a frontend expert. Particularly, the web caching headers are a bit of a mystery to me at this stage.)
My question is, does anyone here have satisfying solutions for this using Nix/NixOS for deployment? I can manually patch in versioning à la 1. in a non-Nix-specific build step. (Full disclosure: I’m currently doing this, but on Guix. I’m planning to eventually migrate to NixOS though for reasons.)
But I’m wondering if there isn’t a nice way to get a version hash out of Nix and patch that in for version 1. Or ideally get variant 2 to work, by serving up several versions of the assets with a prefix. But that would require keeping several versions of a package around. (I’d rather not simply expose and link to the Nix store .)
Or hopefully I’m overthinking this and there’s a better way? Any pointers appreciated!