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.
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.
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
ping
is part of iputils
so adding this package to extraPackages
will make it available. You can find an executable with the tool like nix-locate <bin/executable>
from the package nix-index
However keep in mind that ping
normally requires the SUID bit set.
This tool is available in /run/wrappers/bin/ping
( command -v ping
). This wrapper is created in nixos/modules/tasks/network-interfaces.nix
:
security.wrappers = {
ping = {
owner = "root";
group = "root";
capabilities = "cap_net_raw+p";
source = "${pkgs.iputils.out}/bin/ping";
};
};