Meus programas nativos (no Fedora) são capazes de resolver nomes mDNS/Avahi/zeroconf, assim:
$ ping felonyspork.local -c 1
PING felonyspork.local (192.168.88.169) 56(84) bytes of data.
64 bytes from 192.168.88.169 (192.168.88.169): icmp_seq=1 ttl=64 time=1.73 ms
--- felonyspork.local ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.734/1.734/1.734/0.000 ms
$ ssh felonyspork.local
Last login: Mon Apr 25 16:05:34 2022 from 192.168.88.200
$ exit
Connection to felonyspork.local closed.
No entanto, meus programas instalados no Nix não são:
$ nix-shell -p openssh ssh-tools
[nix-shell:~/src/nixconfig]$ ssh-ping -c 1 felonyspork.local
SSHPING felonyspork.local
--- felonyspork.local ping statistics ---
1 requests transmitted, 0 requests received, 100% request loss
[nix-shell:~/src/nixconfig]$ ssh felonyspork.local
ssh: Could not resolve hostname felonyspork.local: Name or service not known
Eu tenho o mDNS configurado em /etc/nsswitch.conf
:
hosts: files myhostname mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] dns
E avahi-daemon
está rodando no meu sistema.
Como posso fazer com que os programas Nix resolvam corretamente os nomes mDNS? Isso é especialmente importante porque a implantação com Morph requer uma sessão Nix SSH funcional.
Responder1
O elo que falta aqui é nscd
; simplesmente instalar nscd
e iniciar o daemon faz com que os programas instalados pelo Nix funcionem.
$ sudo dnf install nscd
$ sudo systemctl start nscd.service
$ nix-shell -p ssh-tools
[nix-shell:~]$ ssh-ping felonyspork.local
SSHPING felonyspork.local
Pong from felonyspork.local: ssh_seq=1 time=2191 ms
Pong from felonyspork.local: ssh_seq=2 time=1310 ms
^C
--- felonyspork.local ping statistics ---
2 requests transmitted, 2 requests received, 0% request loss