Move around and extend the Nix library functions a little