nix flake refactor: avoid ``with lib;`` & use ``lib.optional*``
Upstream Nixpkgs has been pushing the style of removing ``with lib;``
with the reasoning of clarity around where variables in scope come that
hurt readability & static analysis[*].
While on the topic of ``lib``, introduce ``lib.optional`` &
``lib.optionalString`` in a few more places to tidy up the code while
using common library patterns.