Skip to content

Instantly share code, notes, and snippets.

@robotamer
Last active May 9, 2026 18:28
Show Gist options
  • Select an option

  • Save robotamer/4ca635b09b4a296a78afe1d1678b8f06 to your computer and use it in GitHub Desktop.

Select an option

Save robotamer/4ca635b09b4a296a78afe1d1678b8f06 to your computer and use it in GitHub Desktop.
Nix init
#!/bin/sh
set -eu
NIXI="/opt/nixi"
mkdir -p $NIXI
cd $NIXI
mkdir -p bin cfg etc lib scr srv sys usr var
mkdir -p scr/init.d
mkdir -p sys/db
mkdir -p var/log
mkdir -p /tmp/nix
if ! test -L $NIXI/tmp
then
ln -s /tmp/nix $NIXI/tmp
fi
pathadd() {
[ -d "$1" ] || return
case ":$PATH:" in
*":$1:"*) ;;
*) PATH="$1${PATH+:$PATH}" ;;
esac
}
pathadd "$NIXI/scr"
pathadd "$NIXI/bin"
export NIXI
export PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment