Merge pull request #464 from the-kenny/my-env-exit-commands
Add cleanupCmds option to pkgs.myEnvFun. The downside is that /bin/sh remains in memory to be able to execute cleanup commands.
This commit is contained in:
commit
d7e2acbe97
@ -59,7 +59,7 @@
|
|||||||
{ mkDerivation, substituteAll, pkgs }:
|
{ mkDerivation, substituteAll, pkgs }:
|
||||||
{ stdenv ? pkgs.stdenv, name, buildInputs ? []
|
{ stdenv ? pkgs.stdenv, name, buildInputs ? []
|
||||||
, propagatedBuildInputs ? [], gcc ? stdenv.gcc, cTags ? [], extraCmds ? ""
|
, propagatedBuildInputs ? [], gcc ? stdenv.gcc, cTags ? [], extraCmds ? ""
|
||||||
, shell ? "${pkgs.bashInteractive}/bin/bash"}:
|
, cleanupCmds ? "", shell ? "${pkgs.bashInteractive}/bin/bash"}:
|
||||||
|
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
# The setup.sh script from stdenv will expect the native build inputs in
|
# The setup.sh script from stdenv will expect the native build inputs in
|
||||||
@ -133,8 +133,15 @@ mkDerivation {
|
|||||||
fi
|
fi
|
||||||
rm -fr "\$tmp"
|
rm -fr "\$tmp"
|
||||||
${extraCmds}
|
${extraCmds}
|
||||||
|
|
||||||
|
nix_cleanup() {
|
||||||
|
${cleanupCmds}
|
||||||
|
}
|
||||||
|
|
||||||
export PATH
|
export PATH
|
||||||
echo $name loaded
|
echo $name loaded
|
||||||
|
|
||||||
|
trap nix_cleanup EXIT
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
@ -10,4 +10,5 @@ export buildInputs
|
|||||||
export NIX_STRIP_DEBUG=0
|
export NIX_STRIP_DEBUG=0
|
||||||
export TZ="$OLDTZ"
|
export TZ="$OLDTZ"
|
||||||
|
|
||||||
exec @shell@ --norc
|
@shell@ --norc
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user