Hello there, first and foremost, let me say that is my first message in this forum, so if I don’t do something the way it should be done, please let me know and I will gladly edit whatever is necessary.
I’m trying to package a program called RunJS which is nothing more than a customisable Node.js sandbox for coding in JavaScript and Typescript. Despite being closed source, prebuilt binaries are available in their GitHub repo. If I’m not mistaken, the app has been created using Electron.js.
This is my first derivation attempt, and I decided to go with the latest release (v.2.90). After a while surfing through the web on StackOverflow and some other forums, I managed to successfully build the derivation using the method 4 of this glorious guide, which uses the autoPatchelfHook
to fix the libraries and dependencies (if I did understand correctly, I am not an expert, up until 4 hours ago I didn’t even know what ELF was).
So, I ended up with this derivation (which tries to patch the *_amd_64.deb package):
{
alsa-lib,
autoPatchelfHook,
atk,
dpkg,
fetchurl,
glib,
gtk3,
libdrm,
libXcomposite,
libXdamage,
libxkbcommon,
libXrandr,
mesa,
nss,
stdenv
}:
let
version = "2.9.0";
in rec {
runjs = stdenv.mkDerivation rec {
name = "RunJS";
src = fetchurl {
url = "https://github.com/lukehaas/RunJS/releases/download/v${version}/runjs_${version}_amd64.deb";
sha256 = "084xhdx3m3d1wrpp7qg1xq95j3587001y5wk27qn4yqww233sv5x";
};
nativeBuildInputs = [
autoPatchelfHook
dpkg
];
buildInputs = [
alsa-lib
atk
glib
gtk3
nss
mesa
libXrandr
libXcomposite
libXdamage
libxkbcommon
libdrm
];
meta = {
description = "RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.";
homepage = "https://github.com/lukehaas/RunJS";
# It's a limited free to use, but the code is not public.
# license = stdenv.licenses.unfree;
};
unpackPhase = "true";
installPhase = ''
mkdir -p $out
dpkg -x $src $out
cp -av $out/opt/RunJS/* $out
rm -rf $out/opt
'';
};
}
which is on a file called runjs.nix
. Then, with the following default.nix
:
{ pkgs ? import <nixpkgs> { } }:
pkgs.callPackage ./runjs.nix { }
and running nix-build
the derivation successfuly builds and I get my result
symlink in the same folder. However, when I try to execute it, the process crashes with the following message:
fish: Job 1, './result/runjs' terminated by signal SIGTRAP (Trace or breakpoint trap)
I searched a little, but I’m not sure how what I found relates to the process crash, so I came here to see if I could get some assistance. I have no idea what this implies.
I’m still a relative rookie with NixOS, but I’m really enjoying it so far, so any assistance in getting this to work would be highly appreciated. Please let me know if more context or information is required to debug this issue.