Updating the script of loading myEnv environments, for something close to what I was using.
It sets a fixed PS1, maybe breaking someone's taste, though. But I find it easier to use. svn path=/nixpkgs/trunk/; revision=33304
This commit is contained in:
parent
49fabfacab
commit
fc3ac31540
@ -53,9 +53,10 @@
|
|||||||
# $ load-nix-env
|
# $ load-nix-env
|
||||||
# The result using that command should be:
|
# The result using that command should be:
|
||||||
# env-nix loaded
|
# env-nix loaded
|
||||||
|
and show you a shell with a prefixed prompt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
{ mkDerivation, substituteAll, pkgs } : { stdenv ? pkgs.stdenv, name, buildInputs ? [], cTags ? [], extraCmds ? ""} :
|
{ mkDerivation, substituteAll, pkgs } : { stdenv ? pkgs.stdenv, name, buildInputs ? [], cTags ? [], extraCmds ? "", 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
|
||||||
# the buildNativeInputs environment variable.
|
# the buildNativeInputs environment variable.
|
||||||
@ -126,11 +127,9 @@ mkDerivation {
|
|||||||
echo $name loaded
|
echo $name loaded
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cat >> "$out/bin/load-''${name/env-/}-env" << EOF
|
mkdir -p $out/bin
|
||||||
#!/bin/sh
|
sed -e s,@shell@,${shell}, -e s,@myenvpath@,$out/dev-envs/${name}, \
|
||||||
|
-e s,@name@,${name}, ${./loadenv.sh} > $out/bin/load-${name}-env
|
||||||
source "$out/dev-envs/''${name/env-/}"
|
chmod +x $out/bin/load-${name}-env
|
||||||
EOF
|
|
||||||
chmod +x "$out/bin/load-''${name/env-/}-env"
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
13
pkgs/misc/my-env/loadenv.sh
Normal file
13
pkgs/misc/my-env/loadenv.sh
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
OLDPATH="$PATH"
|
||||||
|
OLDTZ="$TZ"
|
||||||
|
source @myenvpath@
|
||||||
|
|
||||||
|
PATH="$PATH:$OLDPATH"
|
||||||
|
export PS1="\n@name@:[\u@\h:\w]\$ "
|
||||||
|
export buildInputs
|
||||||
|
export NIX_STRIP_DEBUG=0
|
||||||
|
export TZ="$OLDTZ"
|
||||||
|
|
||||||
|
exec @shell@ --norc
|
Loading…
x
Reference in New Issue
Block a user