linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / tools / misc / direnv / default.nix
blob5fa6b8db60e7b1abeb2b9b84af25b629fdd8058b
1 { lib, stdenv, fetchFromGitHub, buildGoModule, bash, fish, zsh }:
3 buildGoModule rec {
4   pname = "direnv";
5   version = "2.28.0";
7   src = fetchFromGitHub {
8     owner = "direnv";
9     repo = "direnv";
10     rev = "v${version}";
11     sha256 = "sha256-iZ3Lf7Yg+N9BWyLLF+MrT2gpPT9BTcp6pNMpfqwcZXo=";
12   };
14   vendorSha256 = "sha256-P8NLY1iGh86ntmYsTVlnNh5akdaM8nzcxDn6Nfmgr84=";
16   # we have no bash at the moment for windows
17   BASH_PATH =
18     lib.optionalString (!stdenv.hostPlatform.isWindows)
19     "${bash}/bin/bash";
21   # replace the build phase to use the GNUMakefile instead
22   buildPhase = ''
23     make BASH_PATH=$BASH_PATH
24   '';
26   installPhase = ''
27     make install PREFIX=$out
28   '';
30   checkInputs = [ fish zsh ];
32   checkPhase = ''
33     export HOME=$(mktemp -d)
34     make test-go test-bash test-fish test-zsh
35   '';
37   meta = with lib; {
38     description = "A shell extension that manages your environment";
39     longDescription = ''
40       Once hooked into your shell direnv is looking for an .envrc file in your
41       current directory before every prompt.
43       If found it will load the exported environment variables from that bash
44       script into your current environment, and unload them if the .envrc is
45       not reachable from the current path anymore.
47       In short, this little tool allows you to have project-specific
48       environment variables.
49     '';
50     homepage = "https://direnv.net";
51     license = licenses.mit;
52     maintainers = with maintainers; [ zimbatm ];
53   };