Thank you for confirming that the two variants are identical in function, and for putting it in historical and architectural context! As for that pattern, I wasn’t aware of it (and, as far as I know, these are conventions that emerged over time and are not documented anywhere).
Readability is a subjective quality (e.g., my preferred style of indentation would probably make others frustrated), and looking up other examples of the “removeAttrs
-in-the-end” pattern, I get it now; runCommandWith
is just too simple to show its benefits.
I think these are good examples:
- https://github.com/NixOS/nixpkgs/blob/5a1a454d366d84f98b8d2ee6537fdf2f16b79037/pkgs/applications/emulators/retroarch/cores.nix#L50
- https://github.com/NixOS/nixpkgs/blob/5a1a454d366d84f98b8d2ee6537fdf2f16b79037/pkgs/applications/science/math/sage/sage-src.nix#L11-L57
- https://github.com/NixOS/nixpkgs/blob/5a1a454d366d84f98b8d2ee6537fdf2f16b79037/pkgs/build-support/fetchpatch/default.nix