I will be sharing any interesting small nix applications here.
Go to pg-server, for simple setup and execution of Postgres servers locally without Docker.
Enable nix-shell to use the closest default.nix
or shell.nix
from current directory upwards
til /
, by adding the following to your .bashrc:
function nix-shell-parent {
function findShellInPath {
path=$1
[ -e "$path/default.nix" ] && echo "$path/default.nix"
[ -e "$path/shell.nix" ] && echo "$path/shell.nix"
}
path=$(pwd)
shellFile=""
while [[ "$path" != "" && "$shellFile" == "" ]]; do
shellFile="`findShellInPath $path`"
path="${path%/*}"
done
if [[ "$shellFile" == "" ]]; then
# above loop fails to check for shell files under /
shellFile="`findShellInPath /`"
fi
[[ "$shellFile" == "" ]] && {
echo 'no default.nix/shell.nix found in . / .. / etc.'
return 1
}
echo "entering nix shell with $shellFile"
nix-shell "$@" "$shellFile"
}