[Nix-dev] Q - Querying for common C tools like make and kernel headers

James Cook james.cook at utoronto.ca
Sat Mar 28 05:52:44 CET 2015


On 3 March 2015 at 16:02, Tony Su <tonysu at su-networking.com> wrote:
>  Objective:
> Install VMware Guest Tools
>
> Common requirement:
> Common Development tools like make, gnu c compiler, often packaged
> together by distro maintainers
> Kernel headers and related code to modify existing kernel
>
> Initial package query does not return anything, ie
> nix-env -qa make
> nix-env -qa kernel
>
> Suggestions on how these types of packages are listed and installed?
>
> TIA,
> Tony

On NixOS, if I type a command that's not installed, I see a message like this:

    $ java
    The program ‘java’ is currently not installed. It is provided by
    several packages. You can install it by typing one of the following:
      nix-env -i jdk
      nix-env -i openjdk
      nix-env -i openjre

If you're not using NixOS, maybe you can get it working using the
source: https://github.com/NixOS/nixos/blob/master/modules/programs/bash/command-not-found.nix

If you already have the command installed and just want to know where
it comes from, you can try something like this:

     $ ls -l $(which make)
    lrwxrwxrwx 1 root nixbld 64 Dec 31  1969
/home/james/.nix-profile/bin/make ->
/nix/store/5188x85vx0y3pd5b713bgsm260536275-gnumake-4.1/bin/make

If you need the attribute name rather than the package name, I think
nix-env -qP is supposed to get that for you, but it doesn't work for
me for some reason.  You can always use the git grep command on
nixpkgs.

James


More information about the nix-dev mailing list