Unverified Commit fa8de42e authored by Jörg Thalheim's avatar Jörg Thalheim Committed by GitHub
Browse files

Merge pull request #126137 from lrworth/nix-direnv-configurable-flakes

nix-direnv: make flakes support optional and off by default
parents c5bff358 03310df8
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
{ 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"
  '';