summary refs log tree commit diff
diff options
context:
space:
mode:
authorVictor Engmark <victor@engmark.name>2021-11-14 15:54:33 +1300
committerVictor Engmark <victor@engmark.name>2021-11-14 16:04:46 +1300
commit57b496ea98bdbd633c48f16af1c69a196aaf963a (patch)
treee12cd5e6735aa44ae5725d8210b933de4a1234aa
parent90dbec47b7c8eff5262fda73d97335fb29e079fa (diff)
downloadnixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar.gz
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar.bz2
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar.lz
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar.xz
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.tar.zst
nixpkgs-57b496ea98bdbd633c48f16af1c69a196aaf963a.zip
misc: Replace tab indentation with spaces
I've tried to be consistent, using four or eight spaces to line up
with existing code.
-rw-r--r--pkgs/build-support/fetchmtn/builder.sh48
-rw-r--r--pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh6
-rw-r--r--pkgs/build-support/setup-hooks/shorten-perl-shebang.sh6
-rwxr-xr-xpkgs/data/fonts/iosevka/update-bin.sh20
-rw-r--r--pkgs/data/misc/geolite-legacy/builder.sh12
-rw-r--r--pkgs/desktops/gnustep/make/builder.sh60
-rw-r--r--pkgs/desktops/gnustep/make/setup-hook.sh36
-rw-r--r--pkgs/development/compilers/ios-cross-compile/9.2_builder.sh78
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/setup-hook.sh22
-rwxr-xr-xpkgs/development/libraries/physics/lhapdf/maintainer.sh6
-rw-r--r--pkgs/development/libraries/slib/setup-hook.sh10
-rwxr-xr-xpkgs/development/lisp-modules/clwrapper/cl-wrapper.sh70
-rwxr-xr-xpkgs/development/lisp-modules/from-quicklisp/asdf-description.sh4
-rwxr-xr-xpkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh6
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/filtered-requirements.sh12
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/full-requirements.sh18
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/grab-url.sh13
-rw-r--r--pkgs/development/perl-modules/expression-generator/lib-cache.sh21
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/requirements.sh12
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/retrieve-file-link.sh8
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh8
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/source-download-link.sh10
-rwxr-xr-xpkgs/development/perl-modules/expression-generator/write-nix-expression.sh20
-rw-r--r--pkgs/development/tools/build-managers/tup/setup-hook.sh52
-rwxr-xr-xpkgs/games/dwarf-fortress/update.sh34
-rwxr-xr-xpkgs/os-specific/linux/service-wrapper/service-wrapper.sh70
-rw-r--r--pkgs/tools/graphics/zxing/zxing.sh26
-rwxr-xr-xpkgs/tools/misc/grub/grub1.patches.sh68
-rwxr-xr-xpkgs/tools/typesetting/lout/builder.sh32
29 files changed, 393 insertions, 395 deletions
diff --git a/pkgs/build-support/fetchmtn/builder.sh b/pkgs/build-support/fetchmtn/builder.sh
index c1b0db895bc..73eff9c2725 100644
--- a/pkgs/build-support/fetchmtn/builder.sh
+++ b/pkgs/build-support/fetchmtn/builder.sh
@@ -2,33 +2,33 @@ source $stdenv/setup
 
 set -x
 
-if ! [ -f "$cacheDB" ]; then 
-	echo "Creating cache DB $cacheDB"
-	mtn --db "$cacheDB" db init
+if ! [ -f "$cacheDB" ]; then
+    echo "Creating cache DB $cacheDB"
+    mtn --db "$cacheDB" db init
 fi
 
 header "getting revision $selector";
 
 done=;
 for source in $dbs; do
-	if mtn pull --db "$cacheDB" "$source" "${branch}"; then
-		revision="$(mtn --db "$cacheDB" au toposort $(mtn --db "$cacheDB" au select "$selector") | tail -1)";
-		if [ -n "$revision" ]; then
-			if mtn --db "$cacheDB" au get_revision "$revision"; then
-				echo "found revision $revision"
-				done=1;
-			else
-				echo "revision $revision does not exist";
-			fi
-		else
-			echo "selector $selector does not match any revision";
-		fi
-	else
-		echo "pulling branch $branch wasn't successful";
-	fi;
-	if test -n "$done"; then
-		break;
-	fi;
+    if mtn pull --db "$cacheDB" "$source" "${branch}"; then
+        revision="$(mtn --db "$cacheDB" au toposort $(mtn --db "$cacheDB" au select "$selector") | tail -1)";
+        if [ -n "$revision" ]; then
+            if mtn --db "$cacheDB" au get_revision "$revision"; then
+                echo "found revision $revision"
+                done=1;
+            else
+                echo "revision $revision does not exist";
+            fi
+        else
+            echo "selector $selector does not match any revision";
+        fi
+    else
+        echo "pulling branch $branch wasn't successful";
+    fi;
+    if test -n "$done"; then
+        break;
+    fi;
 done;
 
 stopNest;
@@ -36,10 +36,10 @@ stopNest;
 header "checking out the revision $revision";
 
 if test -n "$done"; then
-	mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}"
+    mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}"
 else
-	echo "Needed revision still not found. Exiting";
-	exit 1;
+    echo "Needed revision still not found. Exiting";
+    exit 1;
 fi;
 
 stopNest
diff --git a/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
index f7c7429eb0b..a5a44271668 100644
--- a/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
+++ b/pkgs/build-support/pkg-config-wrapper/pkg-config-wrapper.sh
@@ -13,9 +13,9 @@ if [ -z "${NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
 fi
 
 if (( ${#role_suffixes[@]} > 0 )); then
-	# replace env var with nix-modified one
+    # replace env var with nix-modified one
     PKG_CONFIG_PATH=$PKG_CONFIG_PATH_@suffixSalt@ exec @prog@ "$@"
 else
-	# pkg-config isn't a bonafied dependency so ignore setup hook entirely
-	exec @prog@ "$@"
+    # pkg-config isn't a bonafied dependency so ignore setup hook entirely
+    exec @prog@ "$@"
 fi
diff --git a/pkgs/build-support/setup-hooks/shorten-perl-shebang.sh b/pkgs/build-support/setup-hooks/shorten-perl-shebang.sh
index 4bf7c0ff1af..825da1bde96 100644
--- a/pkgs/build-support/setup-hooks/shorten-perl-shebang.sh
+++ b/pkgs/build-support/setup-hooks/shorten-perl-shebang.sh
@@ -71,9 +71,9 @@ _shortenPerlShebang() {
             print
         }
     ' "$program" > "$temp" || die
-	# Preserve the mode of the original file
-	cp --preserve=mode --attributes-only "$program" "$temp"
-	mv "$temp" "$program"
+    # Preserve the mode of the original file
+    cp --preserve=mode --attributes-only "$program" "$temp"
+    mv "$temp" "$program"
 
     # Measure the new shebang line length and make sure it's okay. We subtract
     # one to account for the trailing newline that "head" included in its
diff --git a/pkgs/data/fonts/iosevka/update-bin.sh b/pkgs/data/fonts/iosevka/update-bin.sh
index a402f152d8a..68f93f1f26e 100755
--- a/pkgs/data/fonts/iosevka/update-bin.sh
+++ b/pkgs/data/fonts/iosevka/update-bin.sh
@@ -10,19 +10,19 @@ oldVersion=$(nix-instantiate --eval -E 'with import ../../../.. {}; lib.getVersi
 version=$(echo "$release" | jq -r .tag_name | tr -d v)
 
 if test "$oldVersion" = "$version"; then
-	echo "New version same as old version, nothing to do." >&2
-	exit 0
+    echo "New version same as old version, nothing to do." >&2
+    exit 0
 fi
 
 sed -i "s/$oldVersion/$version/" bin.nix
 
 {
-	echo '# This file was autogenerated. DO NOT EDIT!'
-	echo '{'
-	for asset in $(echo "$release" | jq -r '.assets[].name | select(startswith("ttc"))'); do
-		printf '  %s = "%s";\n' \
-			$(echo "$asset" | sed -r "s/^ttc-(.*)-$version.zip$/\1/") \
-			$(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset")
-	done
-	echo '}'
+    echo '# This file was autogenerated. DO NOT EDIT!'
+    echo '{'
+    for asset in $(echo "$release" | jq -r '.assets[].name | select(startswith("ttc"))'); do
+        printf '  %s = "%s";\n' \
+            $(echo "$asset" | sed -r "s/^ttc-(.*)-$version.zip$/\1/") \
+            $(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset")
+    done
+    echo '}'
 } >variants.nix
diff --git a/pkgs/data/misc/geolite-legacy/builder.sh b/pkgs/data/misc/geolite-legacy/builder.sh
index 683b2e8606b..0bb61d863ec 100644
--- a/pkgs/data/misc/geolite-legacy/builder.sh
+++ b/pkgs/data/misc/geolite-legacy/builder.sh
@@ -5,13 +5,13 @@ cd $out/share/GeoIP
 
 # Iterate over all environment variable names beginning with "src":
 for var in "${!src@}"; do
-	# Store the value of the variable with name $var in $src:
-	eval src="\$$var"
+    # Store the value of the variable with name $var in $src:
+    eval src="\$$var"
 
-	# Copy $src to current directory, removing Nix hash from the filename:
-	dest="${src##*/}"
-	dest="${dest#*-}"
-	cp "$src" "$dest"
+    # Copy $src to current directory, removing Nix hash from the filename:
+    dest="${src##*/}"
+    dest="${dest#*-}"
+    cp "$src" "$dest"
 done
 
 gzip -dv *.gz
diff --git a/pkgs/desktops/gnustep/make/builder.sh b/pkgs/desktops/gnustep/make/builder.sh
index 66afe1271ca..39bd7703828 100644
--- a/pkgs/desktops/gnustep/make/builder.sh
+++ b/pkgs/desktops/gnustep/make/builder.sh
@@ -30,92 +30,92 @@ postInstall() {
     # add the current package to the paths
     local tmp="$out/lib/GNUstep/Applications"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_APPS" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp"
     fi
     tmp="$out/lib/GNUstep/Applications"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp"
     fi
     tmp="$out/lib/GNUstep/WebApplications"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_WEB_APPS" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp"
     fi
     tmp="$out/bin"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_TOOLS" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp"
     fi
     tmp="$out/sbin"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$tmp"
     fi
     tmp="$out/lib/GNUstep"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_LIBRARY" in *"${tmp}"*) false;; *) true;; esac; then
-    	addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp"
+            addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp"
     fi
     tmp="$out/include"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_HEADERS" in *"${tmp}"*) false;; *) true;; esac; then
-    	if [ -z "$NIX_GNUSTEP_SYSTEM_HEADERS" ]; then
-    	    export NIX_GNUSTEP_SYSTEM_HEADERS="$tmp"
-    	else
-    	    export NIX_GNUSTEP_SYSTEM_HEADERS+=" $tmp"
-    	fi
+            if [ -z "$NIX_GNUSTEP_SYSTEM_HEADERS" ]; then
+                export NIX_GNUSTEP_SYSTEM_HEADERS="$tmp"
+            else
+                export NIX_GNUSTEP_SYSTEM_HEADERS+=" $tmp"
+            fi
     fi
     tmp="$out/lib"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_LIBRARIES" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp"
     fi
     tmp="$out/share/GNUstep/Documentation"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_DOC" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$tmp"
     fi
     tmp="$out/share/man"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_DOC_MAN" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$tmp"
     fi
     tmp="$out/share/info"
     if [ -d "$tmp" ] && case "$NIX_GNUSTEP_SYSTEM_DOC_INFO" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
     fi
-    
+
     # write the config file
     echo GNUSTEP_MAKEFILES=$GNUSTEP_MAKEFILES >> $conf
     if [ -n "$NIX_GNUSTEP_SYSTEM_APPS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_APPS="$NIX_GNUSTEP_SYSTEM_APPS"
+        echo NIX_GNUSTEP_SYSTEM_APPS="$NIX_GNUSTEP_SYSTEM_APPS"
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_ADMIN_APPS="$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_ADMIN_APPS="$NIX_GNUSTEP_SYSTEM_ADMIN_APPS" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_WEB_APPS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_WEB_APPS="$NIX_GNUSTEP_SYSTEM_WEB_APPS" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_WEB_APPS="$NIX_GNUSTEP_SYSTEM_WEB_APPS" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_TOOLS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_TOOLS="$NIX_GNUSTEP_SYSTEM_TOOLS" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_TOOLS="$NIX_GNUSTEP_SYSTEM_TOOLS" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS="$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS="$NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_LIBRARY" ]; then
-	echo NIX_GNUSTEP_SYSTEM_LIBRARY="$NIX_GNUSTEP_SYSTEM_LIBRARY" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_LIBRARY="$NIX_GNUSTEP_SYSTEM_LIBRARY" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_HEADERS" ]; then
-	echo NIX_GNUSTEP_SYSTEM_HEADERS="$NIX_GNUSTEP_SYSTEM_HEADERS" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_HEADERS="$NIX_GNUSTEP_SYSTEM_HEADERS" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_LIBRARIES" ]; then
-	echo NIX_GNUSTEP_SYSTEM_LIBRARIES="$NIX_GNUSTEP_SYSTEM_LIBRARIES" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_LIBRARIES="$NIX_GNUSTEP_SYSTEM_LIBRARIES" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_DOC" ]; then
-	echo NIX_GNUSTEP_SYSTEM_DOC="$NIX_GNUSTEP_SYSTEM_DOC" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_DOC="$NIX_GNUSTEP_SYSTEM_DOC" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_DOC_MAN" ]; then
-	echo NIX_GNUSTEP_SYSTEM_DOC_MAN="$NIX_GNUSTEP_SYSTEM_DOC_MAN" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_DOC_MAN="$NIX_GNUSTEP_SYSTEM_DOC_MAN" >> $conf
     fi
     if [ -n "$NIX_GNUSTEP_SYSTEM_DOC_INFO" ]; then
-	echo NIX_GNUSTEP_SYSTEM_DOC_INFO="$NIX_GNUSTEP_SYSTEM_DOC_INFO" >> $conf
+        echo NIX_GNUSTEP_SYSTEM_DOC_INFO="$NIX_GNUSTEP_SYSTEM_DOC_INFO" >> $conf
     fi
-    
+
     for i in $out/bin/*; do
-	echo "wrapping $(basename $i)"
-	wrapGSMake "$i" "$out/share/.GNUstep.conf"
+        echo "wrapping $(basename $i)"
+        wrapGSMake "$i" "$out/share/.GNUstep.conf"
     done
 }
 
diff --git a/pkgs/desktops/gnustep/make/setup-hook.sh b/pkgs/desktops/gnustep/make/setup-hook.sh
index b2b90f1e522..177a381100a 100644
--- a/pkgs/desktops/gnustep/make/setup-hook.sh
+++ b/pkgs/desktops/gnustep/make/setup-hook.sh
@@ -20,58 +20,58 @@ addEnvVars() {
     local filename
 
     for filename in $1/share/GNUstep/Makefiles/Additional/*.make ; do
-	if case "${NIX_GNUSTEP_MAKEFILES_ADDITIONAL-}" in *"{$filename}"*) false;; *) true;; esac; then
-	    export NIX_GNUSTEP_MAKEFILES_ADDITIONAL+=" $filename"
-	fi
+    if case "${NIX_GNUSTEP_MAKEFILES_ADDITIONAL-}" in *"{$filename}"*) false;; *) true;; esac; then
+        export NIX_GNUSTEP_MAKEFILES_ADDITIONAL+=" $filename"
+    fi
     done
 
     local tmp="$1/lib/GNUstep/Applications"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_APPS "$tmp"
     fi
     tmp="$1/lib/GNUstep/Applications"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_ADMIN_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_APPS "$tmp"
     fi
     tmp="$1/lib/GNUstep/WebApplications"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_WEB_APPS-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_WEB_APPS "$tmp"
     fi
     tmp="$1/bin"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_TOOLS-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_TOOLS "$tmp"
     fi
     tmp="$1/sbin"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_ADMIN_TOOLS "$tmp"
     fi
     tmp="$1/lib/GNUstep"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_LIBRARY-}" in *"${tmp}"*) false;; *) true;; esac; then
-    	addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp"
+        addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARY "$tmp"
     fi
     tmp="$1/include"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_HEADERS-}" in *"${tmp}"*) false;; *) true;; esac; then
-    	if [ -z "${NIX_GNUSTEP_SYSTEM_HEADERS-}" ]; then
-    	    export NIX_GNUSTEP_SYSTEM_HEADERS="$tmp"
-    	else
-    	    export NIX_GNUSTEP_SYSTEM_HEADERS+=" $tmp"
-    	fi
+        if [ -z "${NIX_GNUSTEP_SYSTEM_HEADERS-}" ]; then
+            export NIX_GNUSTEP_SYSTEM_HEADERS="$tmp"
+        else
+            export NIX_GNUSTEP_SYSTEM_HEADERS+=" $tmp"
+        fi
     fi
     tmp="$1/lib"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_LIBRARIES-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_LIBRARIES "$tmp"
     fi
     tmp="$1/share/GNUstep/Documentation"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_DOC "$tmp"
     fi
     tmp="$1/share/man"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC_MAN-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_MAN "$tmp"
     fi
     tmp="$1/share/info"
     if [ -d "$tmp" ] && case "${NIX_GNUSTEP_SYSTEM_DOC_INFO-}" in *"${tmp}"*) false;; *) true;; esac; then
-	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
+    addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
     fi
 }
 addEnvHooks "$targetOffset" addEnvVars
diff --git a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh
index 4604b1fdea7..68ba3ed3a92 100644
--- a/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh
+++ b/pkgs/development/compilers/ios-cross-compile/9.2_builder.sh
@@ -8,43 +8,43 @@ function extract
 
     case "$1" in
         *.tar.xz)
-	    xz -dc $1 | tar "$tarflags" - ;;
-	*)
-	    printf "Make sure you give a iPhoneOS9.2.sdk.tar.xz file \n" ;;
+        xz -dc $1 | tar "$tarflags" - ;;
+    *)
+        printf "Make sure you give a iPhoneOS9.2.sdk.tar.xz file \n" ;;
     esac
 }
 
 function verify_arch {
     case "$1" in
-	# Our good arches.
-	armv7|arm64) ;;
-	*)
-	    local
-	    acc="armv7 | arm64"
-	    error_message=$(
-		printf '%s is not an acceptable arch. Try one of %s' "$1" "$acc"
-			 )
-	    printf "$error_message\n"
-	    exit
+    # Our good arches.
+    armv7|arm64) ;;
+    *)
+        local
+        acc="armv7 | arm64"
+        error_message=$(
+        printf '%s is not an acceptable arch. Try one of %s' "$1" "$acc"
+             )
+        printf "$error_message\n"
+        exit
     esac
 }
 
 function verify_sdk_version {
     sdk_version=$(basename "$1" | grep -P -o "[0-9].[0-9]+")
     case "$sdk_version" in
-	# Make sure the SDK is correct.
-	[5-9].[0-9]) ;;
-	*)
-	    printf 'No iPhone SDK version in file name\n'
+    # Make sure the SDK is correct.
+    [5-9].[0-9]) ;;
+    *)
+        printf 'No iPhone SDK version in file name\n'
     esac
 }
 
 function do_build {
 
     if [ $# -lt 2 ]; then
-	printf "usage: $0 iPhoneOS.sdk.tar* <target cpu>\n" 1>&2
-	printf "i.e. $0 /path/to/iPhoneOS.sdk.tar.xz armv7\n" 1>&2
-	exit 1
+    printf "usage: $0 iPhoneOS.sdk.tar* <target cpu>\n" 1>&2
+    printf "i.e. $0 /path/to/iPhoneOS.sdk.tar.xz armv7\n" 1>&2
+    exit 1
     fi
 
     mkdir -p $out
@@ -54,7 +54,7 @@ function do_build {
     pushd "$cctools_port"/usage_examples/ios_toolchain &> /dev/null
 
     export LC_ALL=C
-    
+
     local
     triple='%s-apple-darwin11'
     target_dir="$PWD/target"
@@ -75,12 +75,12 @@ function do_build {
     extract "$1"
 
     local sys_lib=$(
-    	find $sdk_dir -name libSystem.dylib -o -name libSystem.tbd | head -n1
-    	  )
+        find $sdk_dir -name libSystem.dylib -o -name libSystem.tbd | head -n1
+          )
 
     if [ -z "$sys_lib" ]; then
-    	printf "SDK should contain libSystem{.dylib,.tbd}\n" 1>&2
-    	exit 1
+        printf "SDK should contain libSystem{.dylib,.tbd}\n" 1>&2
+        exit 1
     fi
 
     local sys_root=$(readlink -f "$(dirname $sys_lib)/../..")
@@ -96,18 +96,18 @@ function do_build {
     printf "int main(){return 0;}" | clang -xc -O2 -o "$target_dir"/bin/dsymutil -
 
     clang -O2 -std=c99 $alt_wrapper \
-    	  -DTARGET_CPU=$(printf '"%s"' "$2") \
-    	  -DNIX_APPLE_HDRS=$(
-    	printf '"%s"' "-I$out/$sdk/usr/include"
-    	  ) \
-    	  -DNIX_APPLE_FRAMEWORKS=$(
-    	printf '"%s"' "$out/$sdk/System/Library/Frameworks"
-    	  ) \
-    	  -DNIX_APPLE_PRIV_FRAMEWORKS=$(
-    	printf '"%s"' "$out/$sdk/System/Library/PrivateFrameworks"
-    	  ) \
-    	  -DOS_VER_MIN=$(printf '"%s"' "7.1") \
-    	  -o "$target_dir/bin/$triple-clang"
+          -DTARGET_CPU=$(printf '"%s"' "$2") \
+          -DNIX_APPLE_HDRS=$(
+        printf '"%s"' "-I$out/$sdk/usr/include"
+          ) \
+          -DNIX_APPLE_FRAMEWORKS=$(
+        printf '"%s"' "$out/$sdk/System/Library/Frameworks"
+          ) \
+          -DNIX_APPLE_PRIV_FRAMEWORKS=$(
+        printf '"%s"' "$out/$sdk/System/Library/PrivateFrameworks"
+          ) \
+          -DOS_VER_MIN=$(printf '"%s"' "7.1") \
+          -o "$target_dir/bin/$triple-clang"
 
     pushd "$target_dir"/bin &>/dev/null
 
@@ -141,8 +141,8 @@ function do_build {
     local me=`whoami`
 
     for d in bin libexec SDK; do
-    	chown -R $me:$me target/$d
-    	cp -R target/$d $out
+        chown -R $me:$me target/$d
+        cp -R target/$d $out
     done
 
     # Crucial piece
diff --git a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
index bdfd00009dc..ecf9793b91f 100644
--- a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
+++ b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -1,16 +1,16 @@
 findGdkPixbufLoaders() {
 
-	# choose the longest loaders.cache
-	local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
-	if [[ -f "$loadersCache" ]]; then
-		if [[ -f "${GDK_PIXBUF_MODULE_FILE-}" ]]; then
-			if (( "$(cat "$loadersCache" | wc -l)" > "$(cat "$GDK_PIXBUF_MODULE_FILE" | wc -l)" )); then
-				export GDK_PIXBUF_MODULE_FILE="$loadersCache"
-			fi
-		else
-			export GDK_PIXBUF_MODULE_FILE="$loadersCache"
-		fi
-	fi
+    # choose the longest loaders.cache
+    local loadersCache="$1/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
+    if [[ -f "$loadersCache" ]]; then
+        if [[ -f "${GDK_PIXBUF_MODULE_FILE-}" ]]; then
+            if (( "$(cat "$loadersCache" | wc -l)" > "$(cat "$GDK_PIXBUF_MODULE_FILE" | wc -l)" )); then
+                export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+            fi
+        else
+            export GDK_PIXBUF_MODULE_FILE="$loadersCache"
+        fi
+    fi
 
 }
 
diff --git a/pkgs/development/libraries/physics/lhapdf/maintainer.sh b/pkgs/development/libraries/physics/lhapdf/maintainer.sh
index 92c225f90cc..6e263dcebfd 100755
--- a/pkgs/development/libraries/physics/lhapdf/maintainer.sh
+++ b/pkgs/development/libraries/physics/lhapdf/maintainer.sh
@@ -7,7 +7,7 @@ set -xe
 BASE_URL="https://lhapdfsets.web.cern.ch/lhapdfsets/current/"
 
 for pdf_set in `curl -L $BASE_URL 2>/dev/null | "$SED" -e "s/.*<a href=\"\([^\"/]*.tar.gz\)\".*/\1/;tx;d;:x" | sort -u`; do
-	echo -n "    \"${pdf_set%.tar.gz}\" = \""
-	nix-prefetch-url "${BASE_URL}${pdf_set}" 2>/dev/null | tr -d '\n'
-	echo "\";"
+    echo -n "    \"${pdf_set%.tar.gz}\" = \""
+    nix-prefetch-url "${BASE_URL}${pdf_set}" 2>/dev/null | tr -d '\n'
+    echo "\";"
 done
diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh
index 3c7e91e8188..e820d80e7a4 100644
--- a/pkgs/development/libraries/slib/setup-hook.sh
+++ b/pkgs/development/libraries/slib/setup-hook.sh
@@ -1,12 +1,12 @@
 addSlibPath () {
     if test -f "$1/lib/slib/slibcat"
     then
-	export SCHEME_LIBRARY_PATH="$1/lib/slib/"
-	echo "SLIB found in \`$1'; setting \$SCHEME_LIBRARY_PATH to \`$SCHEME_LIBRARY_PATH'"
+        export SCHEME_LIBRARY_PATH="$1/lib/slib/"
+        echo "SLIB found in \`$1'; setting \$SCHEME_LIBRARY_PATH to \`$SCHEME_LIBRARY_PATH'"
 
-	# This is needed so that `(load-from-path "slib/guile.init")' works.
-	export GUILE_LOAD_PATH="$1/lib:$GUILE_LOAD_PATH"
-	echo "SLIB: setting \$GUILE_LOAD_PATH to \`$GUILE_LOAD_PATH'"
+        # This is needed so that `(load-from-path "slib/guile.init")' works.
+        export GUILE_LOAD_PATH="$1/lib:$GUILE_LOAD_PATH"
+        echo "SLIB: setting \$GUILE_LOAD_PATH to \`$GUILE_LOAD_PATH'"
     fi
 }
 
diff --git a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
index 828920c5acc..d6fec46b449 100755
--- a/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
+++ b/pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
@@ -18,59 +18,59 @@ fi
 export NIX_LISP NIX_LISP_LOAD_FILE NIX_LISP_EXEC_CODE NIX_LISP_COMMAND NIX_LISP_FINAL_PARAMETERS
 
 test -n "$NIX_LISP_LD_LIBRARY_PATH" &&
-	export LD_LIBRARY_PATH="$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}$NIX_LISP_LD_LIBRARY_PATH"
+        export LD_LIBRARY_PATH="$LD_LIBRARY_PATH${LD_LIBRARY_PATH:+:}$NIX_LISP_LD_LIBRARY_PATH"
 
 declare -a NIX_LISP_FINAL_PARAMETERS;
 
 case "$NIX_LISP" in
-	sbcl)
-		NIX_LISP_LOAD_FILE="--load"
-		NIX_LISP_EXEC_CODE="--eval"
+        sbcl)
+                NIX_LISP_LOAD_FILE="--load"
+                NIX_LISP_EXEC_CODE="--eval"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG='--non-interactive'
-		NIX_LISP_FINAL_PARAMETERS=
+                NIX_LISP_FINAL_PARAMETERS=
                 NIX_LISP_FASL_TYPE="fasl"
-		;;
-	ecl)
-		NIX_LISP_LOAD_FILE="-load"
-		NIX_LISP_EXEC_CODE="-eval"
+                ;;
+        ecl)
+                NIX_LISP_LOAD_FILE="-load"
+                NIX_LISP_EXEC_CODE="-eval"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG='--nodebug'
-		NIX_LISP_FINAL_PARAMETERS=
+                NIX_LISP_FINAL_PARAMETERS=
                 NIX_LISP_FASL_TYPE="fas"
-		;;
-	clisp)
-		NIX_LISP_LOAD_FILE="-c -l"
-		NIX_LISP_EXEC_CODE="-x"
+                ;;
+        clisp)
+                NIX_LISP_LOAD_FILE="-c -l"
+                NIX_LISP_EXEC_CODE="-x"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG='-on-error exit'
-		NIX_LISP_FINAL_PARAMETERS="-repl"
+                NIX_LISP_FINAL_PARAMETERS="-repl"
                 NIX_LISP_FASL_TYPE="fas"
-		;;
-	lx86cl64)
-		NIX_LISP_LOAD_FILE="-l"
-		NIX_LISP_EXEC_CODE="-e"
+                ;;
+        lx86cl64)
+                NIX_LISP_LOAD_FILE="-l"
+                NIX_LISP_EXEC_CODE="-e"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG='-b'
-		NIX_LISP_FINAL_PARAMETERS=
+                NIX_LISP_FINAL_PARAMETERS=
                 NIX_LISP_FASL_TYPE="lx64fsl"
-		;;
-	lx86cl)
-		NIX_LISP_LOAD_FILE="-l"
-		NIX_LISP_EXEC_CODE="-e"
+                ;;
+        lx86cl)
+                NIX_LISP_LOAD_FILE="-l"
+                NIX_LISP_EXEC_CODE="-e"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG='-b'
-		NIX_LISP_FINAL_PARAMETERS=
+                NIX_LISP_FINAL_PARAMETERS=
                 NIX_LISP_FASL_TYPE="lx32fsl"
-		;;
-	abcl)
-		NIX_LISP_LOAD_FILE="--load"
-		NIX_LISP_EXEC_CODE="--eval"
+                ;;
+        abcl)
+                NIX_LISP_LOAD_FILE="--load"
+                NIX_LISP_EXEC_CODE="--eval"
                 NIX_LISP_QUIT="(quit)"
                 NIX_LISP_NODEBUG=''
-		NIX_LISP_FINAL_PARAMETERS=
+                NIX_LISP_FINAL_PARAMETERS=
                 NIX_LISP_FASL_TYPE="abcl"
-		;;
+                ;;
 esac
 
 NIX_LISP_ASDF_REGISTRY_CODE="
@@ -127,8 +127,8 @@ eval "$NIX_LISP_PRELAUNCH_HOOK"
 
 if [ -z "$NIX_LISP_SKIP_CODE" ]; then
     "$NIX_LISP_COMMAND" $NIX_LISP_EARLY_OPTIONS \
-	                $NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.$NIX_LISP_FASL_TYPE\")"}" \
-	                $NIX_LISP_EXEC_CODE "$NIX_LISP_ASDF_REGISTRY_CODE" \
-	                ${NIX_LISP_FINAL_PARAMETERS[*]:+"${NIX_LISP_FINAL_PARAMETERS[@]}"} \
-	                "$@"
+                        $NIX_LISP_EXEC_CODE "${NIX_LISP_ASDF_LOAD:-"(load \"$NIX_LISP_ASDF/lib/common-lisp/asdf/build/asdf.$NIX_LISP_FASL_TYPE\")"}" \
+                        $NIX_LISP_EXEC_CODE "$NIX_LISP_ASDF_REGISTRY_CODE" \
+                        ${NIX_LISP_FINAL_PARAMETERS[*]:+"${NIX_LISP_FINAL_PARAMETERS[@]}"} \
+                        "$@"
 fi
diff --git a/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh
index 6c240d15c76..bdb5981bf4f 100755
--- a/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh
+++ b/pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh
@@ -11,6 +11,6 @@
 name="$1"
 
 sbcl --noinform --load "$NIX_QUICKLISP_DIR"/setup.lisp --eval "(ql:quickload :$name)" \
-	--eval "(format t \"~a~%\" (or (asdf::system-description (asdf::find-system \"$name\")) \"\"))" \
-	--eval '(quit)' --script |
+    --eval "(format t \"~a~%\" (or (asdf::system-description (asdf::find-system \"$name\")) \"\"))" \
+    --eval '(quit)' --script |
     tee /dev/stderr | tail -n 1
diff --git a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh
index d2d846b78f2..f8bae899727 100755
--- a/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh
+++ b/pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh
@@ -122,8 +122,8 @@ url="${ql_src##* }"
   with (import <nixpkgs> {});
       fetchdarcs {
         url=''$url'';
-	rev=''$version'';
-	sha256=''0000000000000000000000000000000000000000000000000000000000000000'';
+    rev=''$version'';
+    sha256=''0000000000000000000000000000000000000000000000000000000000000000'';
     }" | nix-instantiate - | tail -n 1 |
     xargs nix-store -r 2>&1 | tee /dev/stderr | grep 'instead has' | tail -n 1 |
     sed -e 's/.* instead has .//;s/[^0-9a-z].*//')
@@ -149,7 +149,7 @@ url="${ql_src##* }"
 }
 
 if [ "$ql_src" = '{"error":"Not Found"}' ]; then
-	echo "# $name: not found"
+    echo "# $name: not found"
 else
 cat << EOF | grep -Ev '^[ ]+$'
 
diff --git a/pkgs/development/perl-modules/expression-generator/filtered-requirements.sh b/pkgs/development/perl-modules/expression-generator/filtered-requirements.sh
index 98c01508fd5..2e3509d68c1 100755
--- a/pkgs/development/perl-modules/expression-generator/filtered-requirements.sh
+++ b/pkgs/development/perl-modules/expression-generator/filtered-requirements.sh
@@ -3,13 +3,13 @@
 source lib-cache.sh;
 
 print_reqs() {
-	module_name="$1";
+    module_name="$1";
 
-	./requirements.sh "$1"| while read; do
-		if let "$(./source-download-link.sh "${REPLY}" | wc -c)" && [ perl != "$REPLY" ]; then
-			echo "$REPLY";
-		fi;
-	done;
+    ./requirements.sh "$1"| while read; do
+        if let "$(./source-download-link.sh "${REPLY}" | wc -c)" && [ perl != "$REPLY" ]; then
+            echo "$REPLY";
+        fi;
+    done;
 }
 
 module_name="$1";
diff --git a/pkgs/development/perl-modules/expression-generator/full-requirements.sh b/pkgs/development/perl-modules/expression-generator/full-requirements.sh
index 29ed83668ed..91218f36f60 100755
--- a/pkgs/development/perl-modules/expression-generator/full-requirements.sh
+++ b/pkgs/development/perl-modules/expression-generator/full-requirements.sh
@@ -3,19 +3,19 @@
 source lib-cache.sh;
 
 print_requirements () {
-	module_name="$1";
+    module_name="$1";
 
-	./requirements.sh "$module_name" | while read; do
-		echo "$REPLY";
-		print_reqs_cache "$REPLY";
-	done | sort | uniq
+    ./requirements.sh "$module_name" | while read; do
+        echo "$REPLY";
+        print_reqs_cache "$REPLY";
+    done | sort | uniq
 };
 
 print_reqs_cache () {
-	module_name="$1";
-	module_basename="${module_name//::/-}";
-	
-	cached_output print_requirements "$module_basename" "$module_name" "full.deps";
+    module_name="$1";
+    module_basename="${module_name//::/-}";
+
+    cached_output print_requirements "$module_basename" "$module_name" "full.deps";
 };
 
 print_reqs_cache "$@";
diff --git a/pkgs/development/perl-modules/expression-generator/grab-url.sh b/pkgs/development/perl-modules/expression-generator/grab-url.sh
index 809cf87fceb..8935cad8cef 100755
--- a/pkgs/development/perl-modules/expression-generator/grab-url.sh
+++ b/pkgs/development/perl-modules/expression-generator/grab-url.sh
@@ -3,13 +3,13 @@
 source lib-cache.sh
 
 get_file() {
-	url="$1";
+    url="$1";
 
-	if [ -n "$url" ]; then 
-		curl "$1";
-	else
-		echo -n;
-	fi;
+    if [ -n "$url" ]; then
+        curl "$1";
+    else
+        echo -n;
+    fi;
 }
 
 url="$1";
@@ -17,4 +17,3 @@ name="$2";
 name=${name:-$(basename "$url")}
 
 cached_output get_file "${name%%.*}" "$url" "${name#*.}"
-
diff --git a/pkgs/development/perl-modules/expression-generator/lib-cache.sh b/pkgs/development/perl-modules/expression-generator/lib-cache.sh
index 7473e2d1c15..65095144bcd 100644
--- a/pkgs/development/perl-modules/expression-generator/lib-cache.sh
+++ b/pkgs/development/perl-modules/expression-generator/lib-cache.sh
@@ -4,16 +4,15 @@
 # Third argument: argument to command
 # Fourth argument: cache type
 cached_output () {
-	cmd="$1";
-	basename="$2";
-	arg="$3";
-	ext="$4";
-	
-	if ! [ -e "cache-${ext//./-}/${basename}.${ext}" ]; then
-		mkdir -p "cache-${ext//./-}";
-		$cmd $arg > "cache-${ext//./-}/${basename}.${ext}";
-	fi;
+    cmd="$1";
+    basename="$2";
+    arg="$3";
+    ext="$4";
 
-	cat "cache-${ext//./-}/${basename}.${ext}";
-}
+    if ! [ -e "cache-${ext//./-}/${basename}.${ext}" ]; then
+        mkdir -p "cache-${ext//./-}";
+        $cmd $arg > "cache-${ext//./-}/${basename}.${ext}";
+    fi;
 
+    cat "cache-${ext//./-}/${basename}.${ext}";
+}
diff --git a/pkgs/development/perl-modules/expression-generator/requirements.sh b/pkgs/development/perl-modules/expression-generator/requirements.sh
index 60ee68d99ad..19b24c55a8e 100755
--- a/pkgs/development/perl-modules/expression-generator/requirements.sh
+++ b/pkgs/development/perl-modules/expression-generator/requirements.sh
@@ -6,12 +6,12 @@ module_name="$1";
 module_basename="${1//::/-}";
 
 print_requirements () {
-	module_name="$1";
-	
-	./retrieve-meta-yaml.sh "$module_name" |
-		sed -re '1,/^requires:/d; /^[a-z]/,$d; s@^\s*@@; s@:\s.*@@';
-	./retrieve-meta-yaml.sh "$module_name" |
-		sed -re '1,/^build_requires:/d; /^[a-z]/,$d; s@^\s*@@; s@:\s.*@@';
+    module_name="$1";
+
+    ./retrieve-meta-yaml.sh "$module_name" |
+        sed -re '1,/^requires:/d; /^[a-z]/,$d; s@^\s*@@; s@:\s.*@@';
+    ./retrieve-meta-yaml.sh "$module_name" |
+        sed -re '1,/^build_requires:/d; /^[a-z]/,$d; s@^\s*@@; s@:\s.*@@';
 };
 
 cached_output print_requirements "$module_basename" "$module_name" "direct.deps";
diff --git a/pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh b/pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh
index a9cf0d94e0d..c8ec5df11b7 100755
--- a/pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh
+++ b/pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh
@@ -6,9 +6,9 @@ file_name="$2";
 version_regexp="${module_basename}(-[0-9.a-z]+){0,1}";
 author_regexp="[A-Z0-9]+";
 
-./retrieve-modulepage.sh "$module_basename" | 
-	egrep "[<]a href=\"[a-z0-9/]*/(${author_regexp}/){0,1}${version_regexp}/${file_name}" |
-	sed -re "s@.*href=\"@@; s@\".*@@" |
-	sed -re 's@^/@http://search.cpan.org/@';
+./retrieve-modulepage.sh "$module_basename" |
+    egrep "[<]a href=\"[a-z0-9/]*/(${author_regexp}/){0,1}${version_regexp}/${file_name}" |
+    sed -re "s@.*href=\"@@; s@\".*@@" |
+    sed -re 's@^/@http://search.cpan.org/@';
 
 echo "$link_line";
diff --git a/pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh b/pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh
index 2c85d45691f..3b162ebe693 100755
--- a/pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh
+++ b/pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh
@@ -3,11 +3,11 @@
 source lib-cache.sh;
 
 print_meta_yaml () {
-	module_name="$1";
-	module_basename="${module_name//::/-}";
+    module_name="$1";
+    module_basename="${module_name//::/-}";
 
-	./grab-url.sh "$(./retrieve-file-link.sh "$module_basename" "META.yml")" \
-		"${module_basename}.meta.yml";
+    ./grab-url.sh "$(./retrieve-file-link.sh "$module_basename" "META.yml")" \
+        "${module_basename}.meta.yml";
 };
 
 module_name="$1";
diff --git a/pkgs/development/perl-modules/expression-generator/source-download-link.sh b/pkgs/development/perl-modules/expression-generator/source-download-link.sh
index 575f47629c2..779d131961f 100755
--- a/pkgs/development/perl-modules/expression-generator/source-download-link.sh
+++ b/pkgs/development/perl-modules/expression-generator/source-download-link.sh
@@ -6,12 +6,12 @@ module_name="$1";
 module_basename="${module_name//::/-}";
 
 write_link() {
-	module_basename="$1";
+    module_basename="$1";
 
-	./retrieve-modulepage.sh "$module_basename" | 
-		grep -A 2 "This Release" |
-		grep href |
-		sed -re 's/.*href="//; s/".*//; s@^/@http://search.cpan.org/@';
+    ./retrieve-modulepage.sh "$module_basename" |
+        grep -A 2 "This Release" |
+        grep href |
+        sed -re 's/.*href="//; s/".*//; s@^/@http://search.cpan.org/@';
 }
 
 cached_output write_link "$module_basename" "$module_basename" src.link;
diff --git a/pkgs/development/perl-modules/expression-generator/write-nix-expression.sh b/pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
index cfe1506640b..9f5cdb9142e 100755
--- a/pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
+++ b/pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
@@ -5,16 +5,16 @@ cd $(dirname $0);
 source lib-cache.sh;
 
 print_expression () {
-	module_name="$1";
-	module_basename="${module_name//::/-}";
-	module_compressedname="perl${module_name//::/}";
-	sourcelink="$(./source-download-link.sh "${module_name}")";
-	version_name="${sourcelink%.tar.*}";
-	version_name="${version_name##*/}";
-	dependencies="$(./filtered-requirements.sh "$module_name" | sed -e 's/^/perl/; s/:://g' | xargs)";
-	source_hash=$(nix-prefetch-url "$sourcelink" 2>/dev/null);
-
-	cat <<EOF
+    module_name="$1";
+    module_basename="${module_name//::/-}";
+    module_compressedname="perl${module_name//::/}";
+    sourcelink="$(./source-download-link.sh "${module_name}")";
+    version_name="${sourcelink%.tar.*}";
+    version_name="${version_name##*/}";
+    dependencies="$(./filtered-requirements.sh "$module_name" | sed -e 's/^/perl/; s/:://g' | xargs)";
+    source_hash=$(nix-prefetch-url "$sourcelink" 2>/dev/null);
+
+    cat <<EOF
 
   ${module_compressedname} = import ../development/perl-modules/generic perl {
     name = "${version_name}";
diff --git a/pkgs/development/tools/build-managers/tup/setup-hook.sh b/pkgs/development/tools/build-managers/tup/setup-hook.sh
index 5bf64ae59d3..b7962c80d46 100644
--- a/pkgs/development/tools/build-managers/tup/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/tup/setup-hook.sh
@@ -1,27 +1,27 @@
 #!/bin/sh
 
 tupConfigurePhase() {
-	runHook preConfigure
-
-	echo -n CONFIG_TUP_ARCH= >> tup.config
-	case "$system" in
-	"i686-*")      echo i386 >> tup.config;;
-	"x86_64-*")    echo x86_64 >> tup.config;;
-	"powerpc-*")   echo powerpc >> tup.config;;
-	"powerpc64-*") echo powerpc64 >> tup.config;;
-	"ia64-*")      echo ia64 >> tup.config;;
-	"alpha-*")     echo alpha >> tup.config;;
-	"sparc-*")     echo sparc >> tup.config;;
-	"aarch64-*")   echo arm64 >> tup.config;;
-	"arm*")        echo arm >> tup.config;;
-	esac
-
-	echo "${tupConfig-}" >> tup.config
-
-	tup init
-	tup generate tupBuild.sh
-
-	runHook postConfigure
+    runHook preConfigure
+
+    echo -n CONFIG_TUP_ARCH= >> tup.config
+    case "$system" in
+    "i686-*")      echo i386 >> tup.config;;
+    "x86_64-*")    echo x86_64 >> tup.config;;
+    "powerpc-*")   echo powerpc >> tup.config;;
+    "powerpc64-*") echo powerpc64 >> tup.config;;
+    "ia64-*")      echo ia64 >> tup.config;;
+    "alpha-*")     echo alpha >> tup.config;;
+    "sparc-*")     echo sparc >> tup.config;;
+    "aarch64-*")   echo arm64 >> tup.config;;
+    "arm*")        echo arm >> tup.config;;
+    esac
+
+    echo "${tupConfig-}" >> tup.config
+
+    tup init
+    tup generate tupBuild.sh
+
+    runHook postConfigure
 }
 
 if [ -z "${dontUseTupConfigure-}" -a -z "${configurePhase-}" ]; then
@@ -30,13 +30,13 @@ fi
 
 
 tupBuildPhase() {
-	runHook preBuild
+    runHook preBuild
 
-	pushd .
-	. tupBuild.sh
-	popd
+    pushd .
+    . tupBuild.sh
+    popd
 
-	runHook postBuild
+    runHook postBuild
 }
 
 if [ -z "${dontUseTupBuild-}" -a -z "${buildPhase-}" ]; then
diff --git a/pkgs/games/dwarf-fortress/update.sh b/pkgs/games/dwarf-fortress/update.sh
index e36badc4199..0ef9a40c7a5 100755
--- a/pkgs/games/dwarf-fortress/update.sh
+++ b/pkgs/games/dwarf-fortress/update.sh
@@ -3,13 +3,13 @@
 
 # systems to generate hashes for
 systems='linux linux32 osx osx32
-	 win win_s win32 win32_s
+     win win_s win32 win32_s
          legacy legacy_s legacy32 legacy32_s'
 
 if [ $# -eq 0 ]; then
     versions="$(curl http://www.bay12games.com/dwarves/ \
-		   | grep 'DWARF FORTRESS CLASSIC ' \
-		   | sed 's/.*DWARF FORTRESS CLASSIC \([0-9.]*\) .*/\1/')"
+           | grep 'DWARF FORTRESS CLASSIC ' \
+           | sed 's/.*DWARF FORTRESS CLASSIC \([0-9.]*\) .*/\1/')"
 else
     versions="$@"
 fi
@@ -18,23 +18,23 @@ tmp1="$(mktemp)"
 tmp2="$(mktemp)"
 for version in $versions; do
     for system in $systems; do
-	echo -n $version,$system,
-	ver=$(echo $version | sed -e s,^0\.,, | tr . _)
-	if [[ "$system" = *win* ]] || [[ "$system" = *legacy* ]]; then
-	    ext=zip
-	else
-	    ext=tar.bz2
-	fi
-	nix-prefetch-url \
-	    http://www.bay12games.com/dwarves/df_${ver}_${system}.${ext}
+    echo -n $version,$system,
+    ver=$(echo $version | sed -e s,^0\.,, | tr . _)
+    if [[ "$system" = *win* ]] || [[ "$system" = *legacy* ]]; then
+        ext=zip
+    else
+        ext=tar.bz2
+    fi
+    nix-prefetch-url \
+        http://www.bay12games.com/dwarves/df_${ver}_${system}.${ext}
     done
 done | jq --slurp --raw-input \
-	  'split("\n")  | .[:-1] | map(split(",")) |
+      'split("\n")  | .[:-1] | map(split(",")) |
            map({ "version": .[0], "platform": .[1], "sha256": .[2] }) |
-	   group_by(.version) |
-	   map(map({"version": .version, (.platform): .sha256}) | add |
-	       {(.version): .} | map_values(del(.version))) | add' \
-	  > "$tmp1"
+       group_by(.version) |
+       map(map({"version": .version, (.platform): .sha256}) | add |
+           {(.version): .} | map_values(del(.version))) | add' \
+      > "$tmp1"
 
 # Append $tmp1 to game.json. There should be a better way to handle
 # this but all other attempts failed for me.
diff --git a/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh b/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh
index a7c3bc9758b..2889adc1868 100755
--- a/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh
+++ b/pkgs/os-specific/linux/service-wrapper/service-wrapper.sh
@@ -33,12 +33,12 @@
 
 
 is_ignored_file() {
-	case "$1" in
-		skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh)
-			return 0
-		;;
-	esac
-	return 1
+    case "$1" in
+        skeleton | README | *.dpkg-dist | *.dpkg-old | rc | rcS | single | reboot | bootclean.sh)
+            return 0
+        ;;
+    esac
+    return 1
 }
 
 VERSION=$(@coreutils@/bin/basename $0)" ver. 19-04"
@@ -75,35 +75,35 @@ while [ $# -gt 0 ]; do
        if [ -z "${SERVICE}" -a $# -eq 1 -a "${1}" = "--status-all" ]; then
           if [ -d "${SERVICEDIR}" ]; then
              cd ${SERVICEDIR}
-	     for SERVICE in * ; do
-	       case "${SERVICE}" in
-	         functions | halt | killall | single| linuxconf| kudzu)
-	             ;;
-	         *)
-	           if ! is_ignored_file "${SERVICE}" \
-	   	    && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
-	                   out=$(env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
-	                   retval=$?
-	                   if echo "$out" | egrep -iq "usage:"; then
-	                     #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
-	                     echo " [ ? ]  $SERVICE" 1>&2
-	                     continue
-	                   else
-	                     if [ "$retval" = "0" -a -n "$out" ]; then
-	                       #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
-	                       echo " [ + ]  $SERVICE"
-	                       continue
-	                     else
-	                       #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
-	                       echo " [ - ]  $SERVICE"
-	                       continue
-	                     fi
-	                   fi
-	             #env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status
-	           fi
-	           ;;
-	       esac
-	     done
+         for SERVICE in * ; do
+           case "${SERVICE}" in
+             functions | halt | killall | single| linuxconf| kudzu)
+                 ;;
+             *)
+               if ! is_ignored_file "${SERVICE}" \
+               && [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+                       out=$(env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status 2>&1)
+                       retval=$?
+                       if echo "$out" | egrep -iq "usage:"; then
+                         #printf " %s %-60s %s\n" "[?]" "$SERVICE:" "unknown" 1>&2
+                         echo " [ ? ]  $SERVICE" 1>&2
+                         continue
+                       else
+                         if [ "$retval" = "0" -a -n "$out" ]; then
+                           #printf " %s %-60s %s\n" "[+]" "$SERVICE:" "running"
+                           echo " [ + ]  $SERVICE"
+                           continue
+                         else
+                           #printf " %s %-60s %s\n" "[-]" "$SERVICE:" "NOT running"
+                           echo " [ - ]  $SERVICE"
+                           continue
+                         fi
+                       fi
+                 #env -i LANG="$LANG" LANGUAGE="$LANGUAGE" LC_CTYPE="$LC_CTYPE" LC_NUMERIC="$LC_NUMERIC" LC_TIME="$LC_TIME" LC_COLLATE="$LC_COLLATE" LC_MONETARY="$LC_MONETARY" LC_MESSAGES="$LC_MESSAGES" LC_PAPER="$LC_PAPER" LC_NAME="$LC_NAME" LC_ADDRESS="$LC_ADDRESS" LC_TELEPHONE="$LC_TELEPHONE" LC_MEASUREMENT="$LC_MEASUREMENT" LC_IDENTIFICATION="$LC_IDENTIFICATION" LC_ALL="$LC_ALL" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" status
+               fi
+               ;;
+           esac
+         done
           else
              systemctl $sctl_args list-units
           fi
diff --git a/pkgs/tools/graphics/zxing/zxing.sh b/pkgs/tools/graphics/zxing/zxing.sh
index ca6ac60bab6..a38558d8702 100644
--- a/pkgs/tools/graphics/zxing/zxing.sh
+++ b/pkgs/tools/graphics/zxing/zxing.sh
@@ -2,17 +2,17 @@
 choice="$1";
 shift
 case "$choice" in
-	encode | create | write | CommandLineEncoder)
-		zxing-cmdline-encoder "$@";
-		;;
-	decode | read | run | CommandLineRunner)
-		zxing-cmdline-runner "$@";
-		;;
-	help | usage | --help | --usage | -h)
-		zxing read;
-		zxing write;
-		;;
-	*)
-		zxing read "$choice" "$@"
-		;;
+    encode | create | write | CommandLineEncoder)
+        zxing-cmdline-encoder "$@";
+        ;;
+    decode | read | run | CommandLineRunner)
+        zxing-cmdline-runner "$@";
+        ;;
+    help | usage | --help | --usage | -h)
+        zxing read;
+        zxing write;
+        ;;
+    *)
+        zxing read "$choice" "$@"
+        ;;
 esac
diff --git a/pkgs/tools/misc/grub/grub1.patches.sh b/pkgs/tools/misc/grub/grub1.patches.sh
index d3b138ad357..a7db25afb64 100755
--- a/pkgs/tools/misc/grub/grub1.patches.sh
+++ b/pkgs/tools/misc/grub/grub1.patches.sh
@@ -13,39 +13,39 @@ set -u
 
 # https://salsa.debian.org/grub-team/grub-legacy/tree/master/debian/patches
 SERIES=(
-	snapshot.patch
-	menu.lst_gnu-hurd.patch
-	graphics.patch
-	raid.patch
-	raid_cciss.patch
-	xfs_freeze.patch
-	2gb_limit.patch
-	grub-special_device_names.patch
-	grub-xvd_drives.patch
-	initrd_max_address.patch
-	splashimage_help.patch
-	grub-install_addsyncs.patch
-	grub-install_regexp.patch
-	grub-install_aoe_support.patch
-	grub-install_xvd.patch
-	geometry-26kernel.patch
-	print_func.patch
-	mprotect.patch
-	savedefault.patch
-	find-grub-dir.patch
-	intelmac.patch
-	crossreference_manpages.patch
-	ext3_256byte_inode.patch
+    snapshot.patch
+    menu.lst_gnu-hurd.patch
+    graphics.patch
+    raid.patch
+    raid_cciss.patch
+    xfs_freeze.patch
+    2gb_limit.patch
+    grub-special_device_names.patch
+    grub-xvd_drives.patch
+    initrd_max_address.patch
+    splashimage_help.patch
+    grub-install_addsyncs.patch
+    grub-install_regexp.patch
+    grub-install_aoe_support.patch
+    grub-install_xvd.patch
+    geometry-26kernel.patch
+    print_func.patch
+    mprotect.patch
+    savedefault.patch
+    find-grub-dir.patch
+    intelmac.patch
+    crossreference_manpages.patch
+    ext3_256byte_inode.patch
     # Breaks on NixOS.
-	#use_grub-probe_in_grub-install.patch
-	objcopy-absolute.patch
-	no-reorder-functions.patch
+    #use_grub-probe_in_grub-install.patch
+    objcopy-absolute.patch
+    no-reorder-functions.patch
 
-	# We aren't building amd64 binaries, see #244498
-	#fix_amd64_compile.patch
-	modern-automake.patch
-	no-combine-stack-adjustments.patch
-	no-pie.patch
+    # We aren't building amd64 binaries, see #244498
+    #fix_amd64_compile.patch
+    modern-automake.patch
+    no-combine-stack-adjustments.patch
+    no-pie.patch
 )
 
 # Revision mapping to current tip of the 0.97-73 branch.
@@ -63,8 +63,8 @@ in
 EOF
 
 for PATCH in "${SERIES[@]}"; do
-	URL="$prefix/$PATCH"
-	HASH="$(nix-prefetch-url "$URL")"
-	echo "{ url = \"\${prefix}/$PATCH\"; sha256 = \"$HASH\"; }" >> "$FILE"
+    URL="$prefix/$PATCH"
+    HASH="$(nix-prefetch-url "$URL")"
+    echo "{ url = \"\${prefix}/$PATCH\"; sha256 = \"$HASH\"; }" >> "$FILE"
 done
 echo "]" >> "$FILE"
diff --git a/pkgs/tools/typesetting/lout/builder.sh b/pkgs/tools/typesetting/lout/builder.sh
index 61459e48b7f..eab37c3c68f 100755
--- a/pkgs/tools/typesetting/lout/builder.sh
+++ b/pkgs/tools/typesetting/lout/builder.sh
@@ -15,28 +15,28 @@ installDoc ()
     echo "building \`$doc' document..."
     if [ ! -f "doc/$doc/outfile.ps" ]
     then
-      ( PATH="$PWD:$PATH" ;				\
-        cd "doc/$doc" && lout -r4 -o outfile.ps all )	\
+      ( PATH="$PWD:$PATH" ; \
+        cd "doc/$doc" && lout -r4 -o outfile.ps all ) \
       || return 1
     fi
-    cp "doc/$doc/outfile.ps" "$out/doc/lout/$doc.ps" &&		\
-    ps2pdf -dPDFSETTINGS=/prepress -sPAPERSIZE=a4		\
+    cp "doc/$doc/outfile.ps" "$out/doc/lout/$doc.ps" && \
+    ps2pdf -dPDFSETTINGS=/prepress -sPAPERSIZE=a4 \
            "doc/$doc/outfile.ps" "$out/doc/lout/$doc.pdf"
   done
 
   return 0
 }
 
-unpackPhase &&									\
-cd lout-*.* &&									\
-cat makefile |									\
-  sed -e "s|^PREFIX[[:blank:]]*=.*\$|PREFIX = $out|g ;				\
-          s|^LOUTLIBDIR[[:blank:]]*=.*$|LOUTLIBDIR = \$(PREFIX)/lib/lout|g ;	\
-	  s|^LOUTDOCDIR[[:blank:]]*=.*$|LOUTDOCDIR = \$(PREFIX)/doc/lout|g ;	\
-	  s|^MANDIR[[:blank:]]*=.*$|MANDIR = \$(PREFIX)/man|g"			\
-  > "$nixMakefile" &&								\
-mkdir -p "$out/bin" && mkdir -p "$out/lib"					\
-mkdir -p "$out/man" && mkdir -p "$out/doc/lout" &&				\
-make -f "$nixMakefile" CC=cc install installman &&					\
-installDoc &&									\
+unpackPhase && \
+cd lout-*.* && \
+cat makefile | \
+  sed -e "s|^PREFIX[[:blank:]]*=.*\$|PREFIX = $out|g ; \
+    s|^LOUTLIBDIR[[:blank:]]*=.*$|LOUTLIBDIR = \$(PREFIX)/lib/lout|g ; \
+    s|^LOUTDOCDIR[[:blank:]]*=.*$|LOUTDOCDIR = \$(PREFIX)/doc/lout|g ; \
+    s|^MANDIR[[:blank:]]*=.*$|MANDIR = \$(PREFIX)/man|g" \
+  > "$nixMakefile" && \
+mkdir -p "$out/bin" && mkdir -p "$out/lib" \
+mkdir -p "$out/man" && mkdir -p "$out/doc/lout" && \
+make -f "$nixMakefile" CC=cc install installman && \
+installDoc && \
 fixupPhase