use /tmp instead of XDG_RUNTIME_DIR which is /run/user/1000, which defaults to 10% of RAM and kicad-packages3d needs ~6gb
update.sh generates version.nix by default only updates kicad-unstable several options (can be combined) all, update to latest tag and master clean, generate versions.sh from scratch commit, make a git commit