I know how to install some nix packages with nix-env but there are some of them I have no clue how to install,
for example:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/python-modules/pygit2/default.nix
How to install that package?
How can I know the full name of the package just looking at the .nix file?**
nix-env -iA nixos.python3Packages.pygit2. You can replacepython3Packageswith your python version of choice, e.g.python36Packagesinstead.You just cannot.
The reason is that the attribute path of the .nix file is determined by how it is referenced from
<nixpkgs>/pkgs/all-packages/top-level.nix. In this case, the top-level.nix file makes all python packages accessible through thepythonPackagesorpython3packagesattribute. The packages themselves are listed in<nixpkgs>/pkgs/all-packages/python-packages.nixwhere each entry now finally calls the nix expression file of the package, like the one you linked to above.This makes the full attribute path of the package
pkgs.python3Packages.pygit2. A great tool to browse around the nixkpgs attribute set isnix repl "<nixpkgs/nixos>", which drops you into a nix interpreter with tab-completion. When usingnix-envfor imperative software installation, you still have to substitepkgsbynixosin the package's attribute path. I recommend you looking into declarative software management instead anyways, as there you can use the normal attribute path of the package.