Here's an example:
> cat hosts 198.51.100.33 test.tld 2001:db8::33 test.tld 198.51.100.12 test4.tld 2001:db8::12 test6.tld > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test.tld 198.51.100.33 DGRAM test.tld 198.51.100.33 STREAM test.tld 2001:db8::33 DGRAM 2001:db8::33 STREAM > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test4.tld 198.51.100.12 DGRAM test4.tld 198.51.100.12 STREAM test4.tld > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts getent ahosts test6.tld 2001:db8::12 DGRAM test6.tld 2001:db8::12 STREAM test6.tld > LD_PRELOAD=/nix/store/sw2r0gpi9c9rsvqgvi4906yxh948ydsv-nss_wrapper-1.1.16/lib/libnss_wrapper.so NSS_WRAPPER_HOSTS=hosts curl -v test.tld * Host test.tld:80 was resolved. * IPv6: 2001:db8::33 * IPv4: 198.51.100.33 * Trying [2001:db8::33]:80... * Trying 198.51.100.33:80...
Here's an example:
[0] https://cwrap.org/nss_wrapper.html