[nixos] fixing dependencies and building with recent package managers #796
chrisheib
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When trying to get a dev environment running for this I ran into a bunch of problems. It seems on linux the main electron app dev only runs on a really narrow set of Ubuntu 20 dependencies, which at this point is already deprecated. When setting up a nix shell to develop this, there where multiple problems I tried solving.
Firstly
npm ididn't want to run because electron-overlay-window v3 depends on a hopelessly outdated (and insecure) version of electron and napi. When trying to install electron with any kind of modernish package management it always defaults to newer versions, which have a different API in napi_create_buffer, which required a patch to the electron-overlay-window module:Applying this requires a few extra steps:
cd main npm i --ignore-scripts npm i -D patch-package npx patch-package npm iThis should probably be fixable in a better way by upgrading to electron-overlay-window v4.
On Nixos it's not easily possible to use the bundled electron, so I needed to use the one from nixpkgs.
This one doesn't get recognized by node out of the box, so I needed to add a small dynamic wrapper to the nix shell hook to create a electron script that includes the shell dependency libraries:
Afterwards add that script location as env var ELECTRON_BINARY, and change the main/build/script.mjs to reference it instead of the bundled electron:
Full working environment is in my fork: chrisheib@39347bc
Beta Was this translation helpful? Give feedback.
All reactions