mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 14:22:50 +03:00
Adding documentation to wrap.sh, added ability to retain any desired environment variables.
This commit is contained in:
parent
ee1f140d40
commit
06ff4af597
@ -47,11 +47,24 @@
|
||||
# Execute after shell hook
|
||||
, postShellHook ? ""
|
||||
|
||||
# Environment variables to set in wrapper scripts, in addition to
|
||||
# PYTHONPATH and PATH.
|
||||
, setEnvVars ? []
|
||||
|
||||
, ... } @ attrs:
|
||||
|
||||
|
||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||
if disabled then throw "${name} not supported for interpreter ${python.executable}" else python.stdenv.mkDerivation (attrs // {
|
||||
if disabled
|
||||
then throw "${name} not supported for interpreter ${python.executable}"
|
||||
else
|
||||
|
||||
let
|
||||
inherit (builtins) hasAttr;
|
||||
inherit (lib) mapAttrs concatStringsSep optionals hasSuffix;
|
||||
in
|
||||
|
||||
python.stdenv.mkDerivation (attrs // {
|
||||
inherit doCheck;
|
||||
|
||||
name = namePrefix + name;
|
||||
|
@ -41,9 +41,17 @@ wrapPythonProgramsIn() {
|
||||
# wrapProgram creates the executable shell script described
|
||||
# above. The script will set PYTHONPATH and PATH variables.!
|
||||
# (see pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
wrapProgram $f \
|
||||
local wrap_args="$f \
|
||||
--prefix PYTHONPATH ':' $program_PYTHONPATH \
|
||||
--prefix PATH ':' $program_PATH
|
||||
--prefix PATH ':' $program_PATH"
|
||||
|
||||
# Add any additional environment variables to propagate.
|
||||
for env_var in $setEnvVars; do
|
||||
# Look up the value of this variable
|
||||
local value=$(eval "echo \$$env_var")
|
||||
wrap_args="$wrap_args --set $env_var $value"
|
||||
done
|
||||
wrapProgram $wrap_args
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user