gr-base/platform/default.nix

31 lines
712 B
Nix

{ pkgs, denoCache }:
pkgs.stdenv.mkDerivation {
name = "loom";
src = ./loom;
buildPhase = ''
export DENO_DIR=$TMPDIR/.deno_cache
echo "Deno cache is ${denoCache}"
cp -rL "${denoCache}" "$DENO_DIR"/ 2>/dev/null || true
chmod -R u+w "$DENO_DIR" 2>/dev/null || true
echo "DENO_DIR is $DENO_DIR"
${pkgs.deno}/bin/deno task build:editor
'';
installPhase = ''
mkdir -p $out/bin $out/editor
cp -r editor/dist $out/editor/dist
cp -r mod.ts deno.json deno.lock $out
cp -r cli $out
# This is meant to be executed from inside a devShell with Deno set up
cat > $out/bin/loom <<EOF
#!/bin/sh
cd $out
exec deno task run "\$@"
EOF
chmod +x $out/bin/loom
'';
}