static-nix-shell: add support for extra nativeBuildInputs
This commit is contained in:
@@ -62,6 +62,15 @@ in rec {
|
|||||||
stdenv.mkDerivation (final: {
|
stdenv.mkDerivation (final: {
|
||||||
version = "0.1.0"; # default version
|
version = "0.1.0"; # default version
|
||||||
preferLocalBuild = true;
|
preferLocalBuild = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
makeWrapperArgs = [
|
||||||
|
"--suffix" "PATH" ":" (lib.makeBinPath pkgsEnv')
|
||||||
|
] ++ extraMakeWrapperArgs;
|
||||||
|
|
||||||
patchPhase = ''
|
patchPhase = ''
|
||||||
substituteInPlace ${srcPath} \
|
substituteInPlace ${srcPath} \
|
||||||
--replace '#!/usr/bin/env nix-shell' '#!${interpreter}' \
|
--replace '#!/usr/bin/env nix-shell' '#!${interpreter}' \
|
||||||
@@ -69,10 +78,7 @@ in rec {
|
|||||||
'#!nix-shell -i ${interpreterName}${pkgsStr}' \
|
'#!nix-shell -i ${interpreterName}${pkgsStr}' \
|
||||||
'# nix deps evaluated statically'
|
'# nix deps evaluated statically'
|
||||||
'';
|
'';
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
|
||||||
makeWrapperArgs = [
|
|
||||||
"--suffix" "PATH" ":" (lib.makeBinPath pkgsEnv')
|
|
||||||
] ++ extraMakeWrapperArgs;
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
@@ -89,7 +95,15 @@ in rec {
|
|||||||
|
|
||||||
runHook postInstall
|
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.
|
# `mkShell` specialization for `nix-shell -i bash` scripts.
|
||||||
|
Reference in New Issue
Block a user