Direnv or nix-direnv

I wanted to play around with direnv but nix seems to have two packages defined for it?

nixos.direnv

nixos.nix-direnv

Whats the difference, and what should i be playing with?

1 Like

Hey @nixinator

Usually in such cases, I go to Nixpkgs’ repo to check the source code and find out what are the differences between such attributes. But if you don’t feel like it, you can for instance:

nix eval --json -f "<nixpkgs>" nix-direnv.meta | jq

And:

nix eval --json -f "<nixpkgs>" direnv.meta | jq

Which would give you probably all the information you would want. If you are only interested in the short description, you can use nix search instead of nix-env -qa (which I assume is what you used). The homepages of the projects are:

And:

If you’d read about direnv’s use_nix in the wiki, you’ll see how nix-direnv is an “extension” for direnv. And remember that direnv is not a nix specific tool, it is used by other distributions’ users as well, it just happens to be a popular within Nix users, due to use_nix (no matter what implementation you use).

2 Likes

I see , i suppose the one of the greatest thing about nix is that it has over 40,000 packages, and the worse thing about nix is that is has 40,000 (with similar names and nixifed version of them ;-).

Naming thing in computer science is HARD, and typosquatting, however friendly :wink: can lead to confusing conundrums

I propose that

nix search

returns both

meta.homepage

as well as

meta.description

to avoid source level groking.

1 Like

If you use home-manager, you can follow the instructions in nix-direnv’s readme to quickly enable the use of both together through programs.direnv.enableNixDirenvIntegration

1 Like

how to get this without hm in nixos?

Other installation methods are mentioned in the nix-direnv readme. GitHub - nix-community/nix-direnv: A fast, persistent use_nix/use_flake implementation for direnv [maintainer=@Mic92 / @bbenne10]