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

4 messages · Page 1 of 1 (latest)

half bone
#

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
  '';
};

Here it is build log: https://pastebin.com/fjs7JiK8
But running program via nix run or just manually /nix/store/v8j5iwa9ji48rhd63wp9nj22rydrl83x-api/bin/api results in opening Deno repl (pic) and not the actual program
What am I missing here?

half bone
#

Seems like Nix tries to patch executable, and
adding phases = [ "unpackPhase" "buildPhase" ]; fixes that.
Why there are no self-checking mechanism?

half bone