Merge pull request #114622 from aaschmid/fix/nix-direnv

nix-direnv: fix NIX_BIN_PREFIX substitution in built direnvrc
This commit is contained in:
Jörg Thalheim 2021-03-03 09:46:11 +00:00 committed by GitHub
commit 8445826ef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, gnugrep, nix }:
{ lib, stdenv, fetchFromGitHub, gnugrep, nix, nixFlakes }:
stdenv.mkDerivation rec {
pname = "nix-direnv";
@ -14,9 +14,8 @@ stdenv.mkDerivation rec {
# Substitute instead of wrapping because the resulting file is
# getting sourced, not executed:
postPatch = ''
substituteInPlace direnvrc \
--replace "\''${NIX_BIN_PREFIX:-}" "\''${NIX_BIN_PREFIX:-${nix}/bin/}" \
--replace "grep" "${gnugrep}/bin/grep"
sed -i "1a NIX_BIN_PREFIX=${nixFlakes}/bin/" direnvrc
substituteInPlace direnvrc --replace "grep" "${gnugrep}/bin/grep"
'';
installPhase = ''