From 75e9ce509e8f5d25e2e764fc6cf201cfa407508c Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 1 Mar 2024 18:07:07 +0000 Subject: [PATCH] static-nix-shell: add support for extra nativeBuildInputs --- pkgs/additional/static-nix-shell/default.nix | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pkgs/additional/static-nix-shell/default.nix b/pkgs/additional/static-nix-shell/default.nix index 61ea703b..b0d7d725 100644 --- a/pkgs/additional/static-nix-shell/default.nix +++ b/pkgs/additional/static-nix-shell/default.nix @@ -62,6 +62,15 @@ in rec { stdenv.mkDerivation (final: { version = "0.1.0"; # default version preferLocalBuild = true; + + nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [ + makeWrapper + ]; + + makeWrapperArgs = [ + "--suffix" "PATH" ":" (lib.makeBinPath pkgsEnv') + ] ++ extraMakeWrapperArgs; + patchPhase = '' substituteInPlace ${srcPath} \ --replace '#!/usr/bin/env nix-shell' '#!${interpreter}' \ @@ -69,10 +78,7 @@ in rec { '#!nix-shell -i ${interpreterName}${pkgsStr}' \ '# nix deps evaluated statically' ''; - nativeBuildInputs = [ makeWrapper ]; - makeWrapperArgs = [ - "--suffix" "PATH" ":" (lib.makeBinPath pkgsEnv') - ] ++ extraMakeWrapperArgs; + installPhase = '' runHook preInstall mkdir -p $out/bin @@ -89,7 +95,15 @@ in rec { runHook postInstall ''; - } // extraDerivArgs // (removeAttrs attrs [ "extraMakeWrapperArgs" "interpreter" "interpreterName" "pkgsEnv" "pkgExprs" "srcPath" ]) + } // extraDerivArgs // (removeAttrs attrs [ + "extraMakeWrapperArgs" + "interpreter" + "interpreterName" + "nativeBuildInputs" + "pkgExprs" + "pkgsEnv" + "srcPath" + ]) ); # `mkShell` specialization for `nix-shell -i bash` scripts.