'NixOS - how to add ping command on code-server terminal

Which package should I add to extraPackages property to make ping command available? I have tried

extraPackages = with pkgs; [ ping ];

But it didnot work, it installs completely different package.



Solution 1:[1]

If you mean this ping, it's in the iputils package:

bash-5.1# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.075 ms
^C
--- 127.0.0.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.075/0.075/0.075/0.000 ms
bash-5.1# which ping
/sbin/ping
bash-5.1# ls -l /sbin/ping 
lrwxrwxrwx 1 root root 69 Jan  1  1980 /sbin/ping -> /nix/store/c8i7qgcvnj3123n8k7yilimgvdl23a31-iputils-20211215/bin/ping

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mike Playle