about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2021-06-08 09:54:54 +0200
committerGitHub <noreply@github.com>2021-06-08 09:54:54 +0200
commitfa8de42e2ade7eb3530a4170afa7cd943e11f764 (patch)
treeabbeceed0d643dca3375d3514b9cc260e3fd85d8 /pkgs/tools
parentc5bff358e90389c33ce3cfb23facc5e660fe82b8 (diff)
parent03310df843a344215b45b2e8aef11ae9402a40e2 (diff)
Merge pull request #126137 from lrworth/nix-direnv-configurable-flakes
nix-direnv: make flakes support optional and off by default
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/nix-direnv/default.nix14
1 files changed, 12 insertions, 2 deletions
diff --git a/pkgs/tools/misc/nix-direnv/default.nix b/pkgs/tools/misc/nix-direnv/default.nix
index 94ce54a2a9acf..526efc65f6a44 100644
--- a/pkgs/tools/misc/nix-direnv/default.nix
+++ b/pkgs/tools/misc/nix-direnv/default.nix
@@ -1,5 +1,15 @@
-{ lib, stdenv, fetchFromGitHub, gnugrep, nixUnstable }:
+{ lib
+, stdenv
+, fetchFromGitHub
+, gnugrep
+, nixStable
+, nixUnstable
+, enableFlakes ? false
+}:
 
+let
+  nix = if enableFlakes then nixUnstable else nixStable;
+in
 stdenv.mkDerivation rec {
   pname = "nix-direnv";
   version = "1.2.6";
@@ -14,7 +24,7 @@ stdenv.mkDerivation rec {
   # Substitute instead of wrapping because the resulting file is
   # getting sourced, not executed:
   postPatch = ''
-    sed -i "1a NIX_BIN_PREFIX=${nixUnstable}/bin/" direnvrc
+    sed -i "1a NIX_BIN_PREFIX=${nix}/bin/" direnvrc
     substituteInPlace direnvrc --replace "grep" "${gnugrep}/bin/grep"
   '';