Reputation: 21
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?**
Upvotes: 2
Views: 2370
Reputation: 147
How to install that package?
nix-env -iA nixos.python3Packages.pygit2
. You can replace python3Packages
with your python version of choice, e.g. python36Packages
instead.
How can I know the full name of the package just looking at the .nix file?
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 the pythonPackages
or python3packages
attribute. The packages themselves are listed in <nixpkgs>/pkgs/all-packages/python-packages.nix
where 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 is nix repl "<nixpkgs/nixos>"
, which drops you into a nix interpreter with tab-completion.
When using nix-env
for imperative software installation, you still have to substite pkgs
by nixos
in 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.
Upvotes: 1