foxpro 🐍
foxpro 🐍12mo ago

`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 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?
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.
4 Replies
foxpro 🐍
foxpro 🐍12mo ago
GitHub
Executables created with `deno compile --target x86_64-unknown-linu...
I'm creating multiple executables for a CLI app created using Deno, for MacOS, Windows and Linux. MacOS works fine, Windows I can't unfortunately test myself, but the Linux executable seems...
foxpro 🐍
foxpro 🐍12mo ago
Seems like Nix tries to patch executable, and adding phases = [ "unpackPhase" "buildPhase" ]; fixes that. Why there are no self-checking mechanism?
foxpro 🐍
foxpro 🐍12mo ago
GitHub
Unable to patch executable produced by deno compile and use it Ni...
I'm trying to build application with deno compile to single executable with Nix and run it in nix container: packages.api = pkgs.stdenv.mkDerivation rec { name = "api"; src = ./api; _...
foxpro 🐍
foxpro 🐍12mo ago
GitHub
Unable to patch executable produced by deno compile and use it in...
I'm trying to build application with deno compile to single executable with Nix and run it in nix container: packages.api = pkgs.stdenv.mkDerivation rec { name = "api"; src = ./api; _...