summary refs log tree commit diff
path: root/pkgs/tools/misc/direnv/default.nix
blob: b04420b083eab6c01db14e9b84faf5cc261886ec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ stdenv, fetchFromGitHub, go, bash }:

stdenv.mkDerivation rec {
  name = "direnv-${version}";
  version = "2.9.0";

  src = fetchFromGitHub {
    owner = "direnv";
    repo = "direnv";
    rev = "v${version}";
    sha256 = "1zi4i2ds8xkbhfcpi52hca4lcwan9gf93bdmd2vwdsry16kn3f6k";
  };

  buildInputs = [ go ];

  buildPhase = ''
    make BASH_PATH=${bash}
  '';

  installPhase = ''
    make install DESTDIR=$out
  '';

  meta = with stdenv.lib; {
    description = "A shell extension that manages your environment";
    longDescription = ''
      Once hooked into your shell direnv is looking for an .envrc file in your
      current directory before every prompt.

      If found it will load the exported environment variables from that bash
      script into your current environment, and unload them if the .envrc is
      not reachable from the current path anymore.

      In short, this little tool allows you to have project-specific
      environment variables.
    '';
    homepage = http://direnv.net;
    license = licenses.mit;
    maintainers = with maintainers; [ zimbatm ];
    inherit (go.meta) platforms;
  };
}