Skip to content

Commit

Permalink
make self-contained
Browse files Browse the repository at this point in the history
  • Loading branch information
kingarrrt committed Dec 14, 2023
1 parent fc1c760 commit f211f25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{ stdenv, nix, lib }:
{ stdenv, nix, lib, coreutils, direnv }:

stdenv.mkDerivation {
name = "nix-direnv";

src = ./.;

postPatch = ''
sed -i "2iNIX_BIN_PREFIX=${nix}/bin" direnvrc
sed -i '2iBIN_PREFIX="${nix}/bin ${coreutils}/bin ${direnv}/bin"' direnvrc
'';

installPhase = ''
Expand Down
5 changes: 3 additions & 2 deletions direnvrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ _nix_direnv_preflight () {
_nix_direnv_fatal "\$direnv environment variable was not defined. Was this script run inside direnv?"
fi

if [[ -n ${NIX_BIN_PREFIX:-} ]]; then
PATH_add "$NIX_BIN_PREFIX"
if [[ -n "${BIN_PREFIX:-}" ]]; then
# shellcheck disable=2086
PATH_add $BIN_PREFIX
fi

# check command min versions, bash check uses $BASH_VERSION with _require_version
Expand Down

0 comments on commit f211f25

Please sign in to comment.