Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-24.05] nix-direnv: 3.0.5 -> 3.0.6 #348640

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 33 additions & 18 deletions pkgs/by-name/ni/nix-direnv/package.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{ resholve, lib, coreutils, direnv, nix, fetchFromGitHub }:
{
resholve,
lib,
coreutils,
nix,
fetchFromGitHub,
writeText,
}:

# resholve does not yet support `finalAttrs` call pattern hence `rec`
# https://github.com/abathur/resholve/issues/107
resholve.mkDerivation rec {
pname = "nix-direnv";
version = "3.0.5";
version = "3.0.6";

src = fetchFromGitHub {
owner = "nix-community";
repo = "nix-direnv";
rev = version;
hash = "sha256-imUlc5v/Ow7dgjCjTyEeet+4lNHLeEwfqGQcB4dKcao=";
hash = "sha256-oNqhPqgQT92yxbKmcgX4F3e2yTUPyXYG7b2xQm3TvQw=";
};

# skip min version checks which are redundant when built with nix
postPatch = ''
sed -i 1iNIX_DIRENV_SKIP_VERSION_CHECK=1 direnvrc
'';

installPhase = ''
runHook preInstall
install -m400 -D direnvrc $out/share/nix-direnv/direnvrc
Expand All @@ -28,7 +30,7 @@ resholve.mkDerivation rec {
default = {
scripts = [ "share/nix-direnv/direnvrc" ];
interpreter = "none";
inputs = [ coreutils nix ];
inputs = [ coreutils ];
fake = {
builtin = [
"PATH_add"
Expand All @@ -43,23 +45,36 @@ resholve.mkDerivation rec {
# cannot be reached when built with nix
"shasum"
];
external = [
# We want to reference the ambient Nix when possible, and have custom logic
# for the fallback
"nix"
];
};
keep = {
"$cmd" = true;
"$direnv" = true;

# Nix fallback implementation
"$_nix_direnv_nix" = true;
"$ambient_nix" = true;
"$NIX_DIRENV_FALLBACK_NIX" = true;
};
execer = [
"cannot:${direnv}/bin/direnv"
"cannot:${nix}/bin/nix"
];
prologue =
(writeText "prologue.sh" ''
NIX_DIRENV_FALLBACK_NIX=''${NIX_DIRENV_FALLBACK_NIX:-${lib.getExe nix}}
'').outPath;
};
};

meta = {
description = "A fast, persistent use_nix implementation for direnv";
homepage = "https://github.com/nix-community/nix-direnv";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ mic92 bbenne10 ];
description = "Fast, persistent use_nix implementation for direnv";
homepage = "https://github.com/nix-community/nix-direnv";
license = lib.licenses.mit;
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [
mic92
bbenne10
];
};
}
Loading