mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
Add cleanupCmds option to pkgs.myEnvFun
This option allows the user to specify commands to run when the shell exits. This can be used to cleanup operations done in `extraCmds'. Signed-off-by: Moritz Ulrich <moritz@tarn-vedra.de>
This commit is contained in:
parent
50f3625f70
commit
d84bfa78e1
@ -59,7 +59,7 @@
|
||||
{ mkDerivation, substituteAll, pkgs }:
|
||||
{ stdenv ? pkgs.stdenv, name, buildInputs ? []
|
||||
, propagatedBuildInputs ? [], gcc ? stdenv.gcc, cTags ? [], extraCmds ? ""
|
||||
, shell ? "${pkgs.bashInteractive}/bin/bash"}:
|
||||
, cleanupCmds ? "", shell ? "${pkgs.bashInteractive}/bin/bash"}:
|
||||
|
||||
mkDerivation {
|
||||
# The setup.sh script from stdenv will expect the native build inputs in
|
||||
@ -133,8 +133,15 @@ mkDerivation {
|
||||
fi
|
||||
rm -fr "\$tmp"
|
||||
${extraCmds}
|
||||
|
||||
nix_cleanup() {
|
||||
${cleanupCmds}
|
||||
}
|
||||
|
||||
export PATH
|
||||
echo $name loaded
|
||||
|
||||
trap nix_cleanup EXIT
|
||||
EOF
|
||||
|
||||
mkdir -p $out/bin
|
||||
|
@ -10,4 +10,5 @@ export buildInputs
|
||||
export NIX_STRIP_DEBUG=0
|
||||
export TZ="$OLDTZ"
|
||||
|
||||
exec @shell@ --norc
|
||||
@shell@ --norc
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user