about summary refs log tree commit diff
path: root/pkgs/by-name/ni
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2023-12-24 21:16:22 +0100
committerGitHub <noreply@github.com>2023-12-24 21:16:22 +0100
commit470305582d2117f494ebd245d5cdba817e02ed14 (patch)
treeaa5f3d9fdc824435e130d0d78ea07088f94986d1 /pkgs/by-name/ni
parent98e792ad9d44bb202bb006286ab87bd681574530 (diff)
parent6deb84aa74026fed292e38abc3bdae896521dbde (diff)
downloadnixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar.gz
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar.bz2
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar.lz
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar.xz
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.tar.zst
nixlib-470305582d2117f494ebd245d5cdba817e02ed14.zip
Merge pull request #275580 from Mic92/nix-direnv
nix-direnv: 3.0.1 -> 3.0.3
Diffstat (limited to 'pkgs/by-name/ni')
-rw-r--r--pkgs/by-name/ni/nix-direnv/package.nix57
1 files changed, 43 insertions, 14 deletions
diff --git a/pkgs/by-name/ni/nix-direnv/package.nix b/pkgs/by-name/ni/nix-direnv/package.nix
index 9ef7510d9817..f718b1e9d692 100644
--- a/pkgs/by-name/ni/nix-direnv/package.nix
+++ b/pkgs/by-name/ni/nix-direnv/package.nix
@@ -1,31 +1,60 @@
-{ lib
-, stdenv
-, fetchFromGitHub
-, nix
-}:
-stdenv.mkDerivation (finalAttrs:{
+{ resholve, lib, coreutils, direnv, nix, fetchFromGitHub }:
+
+# 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.1";
+  version = "3.0.3";
 
   src = fetchFromGitHub {
     owner = "nix-community";
     repo = "nix-direnv";
-    rev = finalAttrs.version;
-    hash = "sha256-bfcQYZViFuo7WsEl47pM7Iclg/paf+cLciX9NgaG01U=";
+    rev = version;
+    hash = "sha256-dwSICqFshBI9/4u40fkEqOuhTndnAx/w88zsnIzEcBk=";
   };
 
-  # Substitute instead of wrapping because the resulting file is
-  # getting sourced, not executed:
+  # skip min version checks which are redundant when built with nix
   postPatch = ''
-    sed -i "1a NIX_BIN_PREFIX=${nix}/bin/" direnvrc
+    sed -i 1iNIX_DIRENV_SKIP_VERSION_CHECK=1 direnvrc
   '';
 
   installPhase = ''
     runHook preInstall
-    install -m500 -D direnvrc $out/share/nix-direnv/direnvrc
+    install -m400 -D direnvrc $out/share/nix-direnv/direnvrc
     runHook postInstall
   '';
 
+  solutions = {
+    default = {
+      scripts = [ "share/nix-direnv/direnvrc" ];
+      interpreter = "none";
+      inputs = [ coreutils nix ];
+      fake = {
+        builtin = [
+          "PATH_add"
+          "direnv_layout_dir"
+          "has"
+          "log_error"
+          "log_status"
+          "watch_file"
+        ];
+        function = [
+          # not really a function - this is in an else branch for macOS/homebrew that
+          # cannot be reached when built with nix
+          "shasum"
+        ];
+      };
+      keep = {
+        "$cmd" = true;
+        "$direnv" = true;
+      };
+      execer = [
+        "cannot:${direnv}/bin/direnv"
+        "cannot:${nix}/bin/nix"
+      ];
+    };
+  };
+
   meta = {
     description = "A fast, persistent use_nix implementation for direnv";
     homepage    = "https://github.com/nix-community/nix-direnv";
@@ -33,4 +62,4 @@ stdenv.mkDerivation (finalAttrs:{
     platforms   = lib.platforms.unix;
     maintainers = with lib.maintainers; [ mic92 bbenne10 ];
   };
-})
+}