static-nix-shell: ensure runtime deps are on PATH

This commit is contained in:
Colin 2023-04-27 08:14:11 +00:00
parent 871975a597
commit 4b8fddeb3f

View File

@ -1,5 +1,6 @@
{ pkgs { pkgs
, lib , lib
, makeWrapper
, python3 , python3
, sane-lib , sane-lib
, stdenv , stdenv
@ -55,12 +56,17 @@ in {
'#!nix-shell -i python3 -p "python3.withPackages (ps: [ ${pyPkgsStr} ])"${pkgsStr}' \ '#!nix-shell -i python3 -p "python3.withPackages (ps: [ ${pyPkgsStr} ])"${pkgsStr}' \
'# nix deps evaluated statically' '# nix deps evaluated statically'
''; '';
runtimeDependencies = pkgsEnv; nativeBuildInputs = [ makeWrapper ];
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
mv ${srcPath} $out/bin/${srcPath} mv ${srcPath} $out/bin/${srcPath}
# ensure that all nix-shell references were substituted # ensure that all nix-shell references were substituted
! grep nix-shell $out/bin/${srcPath} ! grep nix-shell $out/bin/${srcPath}
# add runtime dependencies to PATH
wrapProgram $out/bin/${srcPath} \
--suffix PATH : ${lib.makeBinPath pkgsEnv }
''; '';
} // (removeAttrs attrs [ "pkgs" "pyPkgs" "srcPath" ]) } // (removeAttrs attrs [ "pkgs" "pyPkgs" "srcPath" ])
); );