How can I inspect packages from nix repl?

I want to know how I can inspect packages from nix repl, this is because occasionally, I would like to do something like this:

powerManagement.powerUpCommands = ''
  ${pkgs.kmod}/modprobe -r psmouse
  ${pkgs.kmod}/modprobe psmouse
'';

but then, I wonder if that ${pkgs.kmod}/modprobe is correct, what if ${pkgs.kmod}/bin/modprobe is the correct path. How do I perform an inspection and ensure that the binaries I want to use from a package are in the correct location?

1 Like

With nix repl, simply do:

$ nix repl '<nixpkgs>'
nix-repl> "${pkgs.hello}"
"/nix/store/zwnmwns242s7zzm2f4p0ndqdsxw1jb78-hello-2.12.1"

This gives you the path in the store, that you can inspect as you wish:

# type Ctrl-D te quit nix repl
$ tree /nix/store/zwnmwns242s7zzm2f4p0ndqdsxw1jb78-hello-2.12.1/bin
/nix/store/zwnmwns242s7zzm2f4p0ndqdsxw1jb78-hello-2.12.1/bin
└── hello

0 directories, 1 file
3 Likes