DenoDDeno
Powered by
foxpro 🐍F
Denoβ€’3y agoβ€’
4 replies
foxpro 🐍

`deno compile` in Nix results in `deno repl` starting instead of actual program

I wrote following Nix impure derivation for my Deno app:
packages.api = pkgs.stdenv.mkDerivation rec {
  name = "api";
  src = ./api;
  __noChroot = true;
  __impure = true;
  nativeBuildInputs = with pkgs; [
    deno
    unzip
  ];
  buildPhase = ''
    export DENO_DIR=.deno
    mkdir $DENO_DIR
    runHook preBuild
    export HOME=$(mktemp -d)
    deno compile -A ./main.ts --output ./dist/${name} --target=x86_64-unknown-linux-gnu --unstable
    runHook postBuild
  '';
  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp ./dist/${name} $out/bin/${name}
    ls $out/bin
    runHook postInstall
  '';
};
packages.api = pkgs.stdenv.mkDerivation rec {
  name = "api";
  src = ./api;
  __noChroot = true;
  __impure = true;
  nativeBuildInputs = with pkgs; [
    deno
    unzip
  ];
  buildPhase = ''
    export DENO_DIR=.deno
    mkdir $DENO_DIR
    runHook preBuild
    export HOME=$(mktemp -d)
    deno compile -A ./main.ts --output ./dist/${name} --target=x86_64-unknown-linux-gnu --unstable
    runHook postBuild
  '';
  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp ./dist/${name} $out/bin/${name}
    ls $out/bin
    runHook postInstall
  '';
};

Here it is build log: https://pastebin.com/fjs7JiK8
But running program via
nix run
nix run
or just manually
/nix/store/v8j5iwa9ji48rhd63wp9nj22rydrl83x-api/bin/api 
/nix/store/v8j5iwa9ji48rhd63wp9nj22rydrl83x-api/bin/api 
results in opening Deno repl (pic) and not the actual program
What am I missing here?
image.png
Pastebin
foxpro:~/craft/sferadel/next$ nix build .#api --print-build-logs - ...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Deno Repl Programmatically
jeff.hykinJjeff.hykin / help
3y ago
deno repl start time in container
benjamnBbenjamn / help
3y ago
comparable functionality to node:repl in deno?
j7m4Jj7m4 / help
16mo ago
deno compile optimizations
subbedSsubbed / help
14mo ago