!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

202 Members
58 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
17 Jul 2024
@wst:imagisphe.re@wst:imagisphe.re
{ lib
, stdenv
, fetchFromGitHub
, fetchYarnDeps
, yarn2nix
, yarn
}:

stdenv.mkDerivation rec {
  pname = "jan";
  version = "0.5.2";

  src = fetchFromGitHub {
    owner = "janhq";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-MByI66+fmHQOMMlpA/uJ9/iL8ImAr7XbzW4Hht7CeDM=";
  };

  offlineCache = fetchYarnDeps {
    yarnLock = ./yarn.lock;
    sha256 = lib.fakeSha256;
  };

  nativeBuildInputs = [
    yarn2nix
    yarn
  ];

  buildPhase = ''
    cd joi
    yarn2nix
    yarn build
  '';

  meta = {
    homepage = "https://jan.ai";
    license = lib.licenses.gpl3Only;
  };

}
21:13:48
@wst:imagisphe.re@wst:imagisphe.re As far as I understood from makefile of the project I need to first cd to joi subfolder and build yarn dependencies and then I can put offlineCache as a nativeBuildInput to the main project 21:15:48
@wst:imagisphe.re@wst:imagisphe.reI'm absolutely not sure about what I'm doing, so pardon my ignorance in case it doesn't make any sense21:16:32
@c0ba1t:matrix.orgCobaltThank you, I'll try to take a look at it asap21:32:54
@wst:imagisphe.re@wst:imagisphe.reThere's no rush. I will be happy to accept any help.21:38:51
@c0ba1t:matrix.orgCobaltSo, afaict, this repo contains three node components. A web ui, a server for the corresponding backend and an electron app. The web ui and server can be used separately (see Dockerfile) and the electron app wraps the logic from the other components. You are currently trying to package the electron app. Does that sound about right?21:47:44
@c0ba1t:matrix.orgCobaltTo build the electron app, you require a compiled version of the frontend.21:48:54
@c0ba1t:matrix.orgCobalt And the compiled frontend + docs needs to be copied into the electron source in copy:assets. 21:51:33
@wst:imagisphe.re@wst:imagisphe.reYep, that's what I'm trying to do. 21:56:41
@c0ba1t:matrix.orgCobalt

So my first guess would be to

  1. build the frontend and then
  2. build the electron app
    in separate derivations. For 2. you would have to replicate the logic from copy:assets in the preBuild/ patchPhase phase using the compiled output from 1.
21:53:49

Show newer messages


Back to Room ListRoom Version: 6