nix-direnv

A fast, persistent use_nix/use_flake implementation for direnv [maintainer=@Mic92 / @bbenne10] (by nix-community)

Nix-direnv Alternatives

Similar projects and alternatives to nix-direnv

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better nix-direnv alternative or higher similarity.

nix-direnv discussion

Log in or Post with

nix-direnv reviews and mentions

Posts with mentions or reviews of nix-direnv. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-05-20.
  • Enlightenmentware
    22 projects | news.ycombinator.com | 20 May 2024
    I don't think there's a right way to do it, you are correct in that learning NixOS is pretty tedious.

    Re: flakes, my personal opinion is to use flakes. While Flakes are imperfect, they still provide a lot of functionality that Nix doesn't otherwise have. In my mind, it's like Nix's equivalent of "Go modules" or something like that. I do feel like people who do not like flakes make many valid points (the boilerplate, the fact that the top-level flake expression is a subset of Nix for some reason, etc.) but the argument isn't that those problems shouldn't be solved, it's that flakes are a sub-optimal design. Since they're so proliferated throughout the ecosystem though, it is quite unlikely that Nix or any prominent fork will outright drop flakes support any time in the near future. For better or worse, Flakes are part of the Nix ecosystem for the foreseeable future. In my opinion, one may as well take advantage of that.

    If you haven't already, I'd get your feet wet with installing Nix on a non-NixOS machine first, and please feel free to ask questions about Nix in the NixOS Discourse "Help" section.

    I have some recommendations:

    1. https://github.com/nix-community/nix-direnv - Since Nix derivations usually wrap around other build systems, the entire derivation is recomputed when any file in it changes; using direnv, you can just get your normal dev tools upon cd'ing into your project directories. This gives you a lot of the benefits of Nix during local development, but with your normal stack, and without needing to globally install anything.

    2. If you are trying to build something, chances are you can find inspiration in Nixpkgs. Are you curious how you might package a Bevy game? No problem: literally search "bevy" on the Nixpkgs GitHub repo and see what comes up. I found a derivation that does: https://github.com/NixOS/nixpkgs/blob/master/pkgs/games/jump...

    3. If you use flakes, you should keep the flake "schema" handy. There are a lot of different kinds of flake outputs and there are different ways to specify the same thing, which is somewhat needlessly confusing; keeping the flake schema handy will make it easier to understand what Nix is looking for in a flake, which might make it easier to see what's going on (especially if it's obfuscated.) The most important takeaway here: A command like `nix run flake#attr` will try multiple different attributes. https://nixos.wiki/wiki/flakes#Flake_schema

    4. Likewise, I really recommend reading up on what NixOS modules are. NixOS modules are the basis for configurations on NixOS, and having a clear understanding of what is even going on with them is a good idea. For example, you should understand the difference between the Nix language's `import` directive, and using the NixOS modules `imports` attribute to import other NixOS modules. Understanding how the configuration merge works saves a lot of headache, makes it easier to understand how people's configurations works, and also makes it easier to modularize your own NixOS configurations, too. https://nixos.wiki/wiki/NixOS_modules

    Unfortunately though, there's just no way to make it "click", and I can't guarantee that it's worth all of the effort. For me, I felt it was, but yes, there's no one correct way to do it.

    But please feel free to ask questions if anything seems confusing.

  • Poetry2Nix Development Flake with Matplotlib GTK Support
    5 projects | dev.to | 11 May 2024
    You might want to checkout direnv and nix-direnv for added convenience.
  • A faster, persistent implementation of direnv's use_Nix and use_flake
    1 project | news.ycombinator.com | 27 Aug 2023
  • How do multiple versions of the package internally work?
    2 projects | /r/NixOS | 2 Jul 2023
    BTW: I personally use direnv with nix-direnv. This basically works by setting your shell with proper tooling when you enter the directory.
  • I have a few beginner question, what is the difference between nix shell/env and what is the difference between flakes/home-manager?
    2 projects | /r/NixOS | 18 Jun 2023
    I'm not sure what you mean by nix env, maybe you are referring to nix-direnv?
  • Just a reminder to make sure Garbage Collection is running
    1 project | /r/NixOS | 5 Jun 2023
    Although currently I'm using direnv + nix-direnv. Keep in mind that direnv has builtin nix support which is very basic and doesn't do any caching. So you still needs this add-on to preserve roots.
  • What do you install with configuration.nix and home manager
    1 project | /r/NixOS | 2 Jun 2023
    I distinguish between system level things and user level things, even though I don't really have different users on my machine. I install the bare minimum number of packages + a lot of different drivers in the configuration.nix, and desktop and editor related things in HM. For development environment, I have environment per project using mkShell and https://github.com/nix-community/nix-direnv, which allows you to switch to the specific environment once you cd into the directory. (Although I do have python installed globally with some commonly used packages such as numpy, so I can just start python and write something when I need to, without creating an environment)
  • How do YOU use your PKMS?
    5 projects | /r/PKMS | 21 Apr 2023
    I further make my software projects so that when I click a link I go into an environment pre-loaded with their dependencies so dropping in/out of projects is always frictionless. I do this with the reproducibility guarantees of nix, along with glue like nix-direnv and envrc-mode to direnv.
  • Nuenv: an experimental Nushell environment for Nix
    3 projects | /r/NixOS | 28 Mar 2023
    (I also use nix-direnv)
  • NixOS + Haskell best practices circa March 2023
    6 projects | /r/haskell | 7 Mar 2023
    direnv
  • A note from our sponsor - InfluxDB
    www.influxdata.com | 23 Jun 2024
    Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality. Learn more →

Stats

Basic nix-direnv repo stats
29
1,563
8.9
4 days ago

Sponsored
Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com