How do I trigger the build of a derivation created with node2nix

I am trying to create a derivation that will build Sabaki. It is an electron app, and I am able to make a nix shell environment in which I can build and run the application just fine. However, that does not make for an installable application.

Actually doing this is going to require two steps:

  • Build the application
  • Patch the resulting executable for ld and then wrap it with makeWrapper to include all of the additional libraries that an Electron/GTK app needs to run.

But I’m stuck on part one.

I have used node2nix to generate these files:

I had to modify node-packages.nix line 2109 to point to github, because node2nix generally creates that line pointing to the local directory.

According to the documentation, I should be able to run nix-build composition.nix -A package to do a full build of the application and then get a resulting binary in result/bin. However, when I run it, the only thing I get is the result directory pointing to a directory containing only the source for Sabaki and a build of all of the dependencies, but not the application itself.

I can’t see any sort of npm run build command in node-env.nix.

What do I need to do to invoke the build process? I think if I can get the executable I can take it from there, but this step has me stumped.

Hi @savannidgerinel, why don’t you package the Sabaki AppImage version. It’s easier. See this https://github.com/NixOS/nixpkgs/blob/29062cec8d214013a8e1f944d16e32c36294e0d0/pkgs/applications/misc/joplin-desktop/default.nix

Hi!

I actually did resort to that late last night and push the change this morning to default.nix. That’s also good because for work I’m working on a proprietary electron app that we’re obviously not going to ship source for.

But would this derivation be accepted into nixpkgs (after I did some dependency pruning)? I had thought that open source apps needed to have compile instructions in nixpkgs…

Though actually, I don’t know why I think that…

I’d still like to figure out how to solve this, but using a released AppImage is fine for my purposes today, and I’ll open a PR for it some time soon.