Contains the same fix as in #310673 and #310125 that allows it to build
on Rust >1.76. However, I think this patch might have to be a permanent
one as upstream has been abandoned and unmaintained.
Also removed some spurious `with lib;` and `rec` use, moved to use
`pkgs/by-name` and reformatted using `nixfmt-rfc-style`.