diff --git a/nix/lib.inc.sh b/nix/lib.inc.sh new file mode 100644 index 0000000..0e83f35 --- /dev/null +++ b/nix/lib.inc.sh @@ -0,0 +1,10 @@ +function wrap() { + local TOOL="$1" + local REPO="$2" + shift + shift + + SHELL_NIX="$REPO/shell.nix" + QUOTED_ARGS="$(printf "${1+ %q}" "$@")" + exec nix-shell "$SHELL_NIX" --pure --command "$TOOL $QUOTED_ARGS" +} diff --git a/nix/node b/nix/node new file mode 100755 index 0000000..0642232 --- /dev/null +++ b/nix/node @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +REPO=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +source "$REPO/nix/lib.inc.sh" + +wrap node "$REPO" "$@" diff --git a/nix/yarn b/nix/yarn new file mode 100755 index 0000000..ad1671a --- /dev/null +++ b/nix/yarn @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +REPO=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd) +source "$REPO/nix/lib.inc.sh" + +wrap yarn "$REPO" "$@" diff --git a/shell.nix b/shell.nix index dd47264..6934ce6 100644 --- a/shell.nix +++ b/shell.nix @@ -12,6 +12,7 @@ stdenv.mkDerivation rec { nodejs-16_x rsync sqlite + yarn zlib ];