Used the nixpkgs version of yarn2nix to generate a yarn.nix file.
Made this default.nix:
let
pkgs = import <nixpkgs> {};
electron_t = pkgs.electron_22;
in
rec {
deemix-gui = pkgs.mkYarnPackage {
name = "deemix-gui";
src = ./.;
nativeBuildInputs = [ electron_t ];
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
# NOTE: this is optional and generated dynamically if omitted
yarnNix = ./yarn.nix;
};
}
Running nix-build
When I try to start the app with yarn start I get this error though.
$ yarn start
yarn run v1.22.19
$ electron . --dev
App threw an error during load
Error: Cannot find module 'electron-context-menu'
Require stack:
- ~/deemix-gui/index.js
- /nix/store/d0yi5ahbr0rfba256d28gvyca06g6hv1-electron-22.3.27/libexec/electron/resources/default_app.asar/main.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:963:15)
at n._resolveFilename (node:electron/js2c/browser_init:2:109827)
at Module._load (node:internal/modules/cjs/loader:811:27)
at f._load (node:electron/js2c/asar_bundle:2:13377)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/tobioloke/deemix-gui/index.js:2:21)
at Module._compile (node:internal/modules/cjs/loader:1141:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module 'electron-context-menu'
Require stack:
- ~/deemix-gui/index.js
- /nix/store/d0yi5ahbr0rfba256d28gvyca06g6hv1-electron-22.3.27/libexec/electron/resources/default_app.asar/main.js
-
at Module._resolveFilename (node:internal/modules/cjs/loader:963:15)
at n._resolveFilename (node:electron/js2c/browser_init:2:109827)
at Module._load (node:internal/modules/cjs/loader:811:27)
at f._load (node:electron/js2c/asar_bundle:2:13377)
at Module.require (node:internal/modules/cjs/loader:1035:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/tobioloke/deemix-gui/index.js:2:21)
at Module._compile (node:internal/modules/cjs/loader:1141:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
at Module.load (node:internal/modules/cjs/loader:1011:32)
[576627:1228/094247.277460:ERROR:angle_platform_impl.cc(43)] Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
ERR: Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576627:1228/094247.277729:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576627:1228/094247.277872:ERROR:gl_display.cc(920)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[576627:1228/094247.278040:ERROR:angle_platform_impl.cc(43)] Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
ERR: Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576627:1228/094247.278126:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576627:1228/094247.278189:ERROR:gl_display.cc(920)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[576627:1228/094247.278249:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[576627:1228/094247.280307:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
[576635:1228/094247.310049:ERROR:angle_platform_impl.cc(43)] Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
ERR: Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576635:1228/094247.310278:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576635:1228/094247.310378:ERROR:gl_display.cc(920)] eglInitialize OpenGL failed with error EGL_NOT_INITIALIZED, trying next display type
[576635:1228/094247.310574:ERROR:angle_platform_impl.cc(43)] Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
ERR: Display.cpp:1004 (initialize): ANGLE Display::initialize error 12289: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576635:1228/094247.310656:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: Could not dlopen libGL.so.1: libGL.so.1: cannot open shared object file: No such file or directory
[576635:1228/094247.310727:ERROR:gl_display.cc(920)] eglInitialize OpenGLES failed with error EGL_NOT_INITIALIZED
[576635:1228/094247.310793:ERROR:gl_ozone_egl.cc(23)] GLDisplayEGL::Initialize failed.
[576635:1228/094247.313440:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization
^C
Unfortunately no idea how to bring electron-context-menu in scope.
error Couldn't find any versions for "electron-context-menu" that matches "^3.6.1" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find any versions for "electron-window-state-manager" that matches "^0.3.2" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
at Generator.next (<anonymous>)
at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
Error: Couldn't find any versions for "yargs" that matches "^17.6.2" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
at Generator.next (<anonymous>)
at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
Error: Couldn't find any versions for "electron" that matches "^22.0.0" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
at Generator.next (<anonymous>)
at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
Error: Couldn't find any versions for "electron-builder" that matches "^23.6.0" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
at Generator.next (<anonymous>)
at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
Error: Couldn't find any versions for "pkg" that matches "^5.8.0" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
at Generator.next (<anonymous>)
at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
error: builder for '/nix/store/108pxic7r62xa8nmrbr9f7zvmiv482ci-deemix-gui-modules-.drv' failed with exit code 1;
last 10 log lines:
> at Generator.next (<anonymous>)
> at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
> at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
> Error: Couldn't find any versions for "pkg" that matches "^5.8.0" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
> at MessageError.ExtendableBuiltin (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:721:66)
> at new MessageError (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:750:123)
> at NpmResolver.<anonymous> (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:50438:15)
> at Generator.next (<anonymous>)
> at step (/nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:310:30)
> at /nix/store/xnvjmblg35hi8f3pn409sdpiwv7b40qk-yarn-1.22.19/libexec/yarn/lib/cli.js:321:13
For full logs, run 'nix log /nix/store/108pxic7r62xa8nmrbr9f7zvmiv482ci-deemix-gui-modules-.drv'.
error: 1 dependencies of derivation '/nix/store/ryjivid7yzjvxwjcyzyq3ywdsppfg5pb-deemix-gui-.drv' failed to build
cloning the source repo, and running the derivation works below works
first ran yarn install on the dir to update the lockfile
Then ran NIXPKGS_ALLOW_INSECURE=1 nix-build -E 'with import <nixpkgs> { }; callPackage ./default.nix { }'
{ lib
, stdenv
, fetchFromGitLab
, electron_10
, mkYarnPackage
, makeDesktopItem
, fetchYarnDeps
, makeWrapper
, wrapGAppsHook
, bash
}:
let
electron = electron_10;
in
mkYarnPackage rec {
pname = "deemix-gui";
version = "";
src = ./. ;
packageJSON = "${src}/package.json";
doDist = false;
dontWrapGApps = true;
nativeBuildInputs = [
makeWrapper
wrapGAppsHook
electron
];
propagatedBuildInputs = [ electron ];
installPhase = ''
mkdir -p $out/etc/${pname}
mkdir -p $out/bin
echo "#!{bash}/bin/bash" > $out/bin/${pname}
echo "${electron}/bin/electron $out/etc/${pname}i \
$*" >> $out/bin/${pname}
chmod +x $out/bin/${pname}
cp -r . $out/etc/${pname}
'';
offlineCache = fetchYarnDeps {
yarnLock = "${src}/yarn.lock";
hash = "sha256-6498Zi7xjYdqu10dw3/a9jU37tVKkkxJdj51NHh3QVQ=";
};
env.ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
meta = with lib; {
description = "An electron app that wraps deemix-webui and lets you use the deemix-js library";
downloadPage = "https://gitlab.com/RemixDev/deemix-gui";
homepage = "https://gitlab.com/RemixDev/deemix-gui";
license = licenses.gpl3Only;
maintainers = with maintainers; [ tobz619 ];
};
}
When I try to run it I see
./result/bin/deemix-gui
/nix/store/q59iamxvpb59r0w6gzlmffc98n8vk9cg-electron-10.4.7/bin/electron: error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory
You’ll likely need to do something with makeWrapper and xorg.libXcursor is my guess. But this derivation fixes the error you reported