Add wrapper scripts for node / yarn on NixOS.

This commit is contained in:
baldo 2022-05-19 11:55:38 +02:00
parent 1967637d98
commit 7671bfd4d3
4 changed files with 23 additions and 0 deletions

10
nix/lib.inc.sh Normal file
View file

@ -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"
}

6
nix/node Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
REPO=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
source "$REPO/nix/lib.inc.sh"
wrap node "$REPO" "$@"

6
nix/yarn Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
REPO=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
source "$REPO/nix/lib.inc.sh"
wrap yarn "$REPO" "$@"

View file

@ -12,6 +12,7 @@ stdenv.mkDerivation rec {
nodejs-16_x
rsync
sqlite
yarn
zlib
];