summary refs log tree commit diff
path: root/pkgs/misc/my-env
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2009-02-11 16:12:12 +0000
committerMarc Weber <marco-oweber@gmx.de>2009-02-11 16:12:12 +0000
commit944d6221df8c60d0e2741bc9fd5e14d62f1e8ee5 (patch)
treee2c60dc387f335ad842425b9d438d55c2d4b0c80 /pkgs/misc/my-env
parentca5e6b9624c39bb262e5580613a421de2bedea0f (diff)
my-env: add some hackish support for zsh
svn path=/nixpkgs/trunk/; revision=14034
Diffstat (limited to 'pkgs/misc/my-env')
-rw-r--r--pkgs/misc/my-env/default.nix35
1 files changed, 34 insertions, 1 deletions
diff --git a/pkgs/misc/my-env/default.nix b/pkgs/misc/my-env/default.nix
index 2bf2d86c2c81e..4d06a8b5c8e39 100644
--- a/pkgs/misc/my-env/default.nix
+++ b/pkgs/misc/my-env/default.nix
@@ -69,7 +69,40 @@ mkDerivation {
       phases=
       # only do all the setup stuff in nix-support/*
       set +e
-      source "$s"
+      if [[ -z "\$ZSH_VERSION" ]]; then
+        source "$s"
+      else
+        setopt interactivecomments
+        # fix bash indirection 
+        # let's hope the bash arrays aren't used
+        # substitute is using bash array, so skip it
+        echo '
+            setopt NO_BAD_PATTERN
+            setopt NO_BANG_HIST
+            setopt NO_BG_NICE
+            setopt NO_EQUALS
+            setopt NO_FUNCTION_ARGZERO
+            setopt GLOB_SUBST
+            setopt NO_HUP
+            setopt INTERACTIVE_COMMENTS
+            setopt KSH_ARRAYS
+            setopt NO_MULTIOS
+            setopt NO_NOMATCH
+            setopt RM_STAR_SILENT
+            setopt POSIX_BUILTINS
+            setopt SH_FILE_EXPANSION
+            setopt SH_GLOB
+            setopt SH_OPTION_LETTERS
+            setopt SH_WORD_SPLIT
+          ' >> "\$tmp/script"
+        sed -e 's/\''${!\([^}]*\)}/\''${(P)\1}/g' \
+            -e 's/[[]\*\]//' \
+            -e 's/substitute() {/ substitute() { return; /' \
+            -e 's@PATH=\$@PATH=${pkgs.coreutils}/bin@' \
+            "$s" >> "\$tmp/script"
+        echo "\$tmp/script";
+        source "\$tmp/script";
+      fi
       rm -fr "\$tmp"
       ${extraCmds}
       export PATH