Skip to content

feat: Allow custom resources path via environment variable#215

Merged
josselinonduty merged 1 commit intoaunetx:masterfrom
FelixLusseau:feature/add-resource-path-env-variable-override
Feb 22, 2026
Merged

feat: Allow custom resources path via environment variable#215
josselinonduty merged 1 commit intoaunetx:masterfrom
FelixLusseau:feature/add-resource-path-env-variable-override

Conversation

@FelixLusseau
Copy link
Contributor

Hi

As a long time user of the Deezer-Desktop app with the Ubuntu .deb and my own NixOS derivation, I tried to publish it on Nixpkgs NixOS/nixpkgs#488329.
A Nix derivation is a wrapper to build an app from source or prebuilded packages for Nix packages manager and NixOS users. For deezer-linux, it only consists to put the files in the right place from the .tar.xz releases.

One of the maintainers suggested NixOS/nixpkgs#488329 (review) to use the Nixpkgs packaged Electron instead of the deezer-linux one to reduce the derivation complexity, keep Electron up-to-date and mainly to not rebuild and patch the included Electron to make it working on NixOS (because of the linker differences).

So I made it and I encountered an issue. The default process.resourcesPath is Electron one and not the folder packaged in the .tar.xz so the app is crashing at startup because it is not finding the systray.png icon.

❯ deezer-desktop
13:47:27.399 › Init App
(node:138859) UnhandledPromiseRejectionWarning: Error: Failed to load image from path '/nix/store/6ppl38w30hiygnhzkxagm6yrw9jdl15x-electron-unwrapped-38.7.2/libexec/electron/resources/linux/systray.png'
    at TrayService.init (/nix/store/ffxw5dysivcsw0y18fysxl255rkjyjdq-deezer-desktop-7.1.70/share/deezer-desktop/resources/app.asar/build/main.js:2246:25)
    at Object.<anonymous> (/nix/store/ffxw5dysivcsw0y18fysxl255rkjyjdq-deezer-desktop-7.1.70/share/deezer-desktop/resources/app.asar/build/main.js:2934:25)
    at Generator.next (<anonymous>)
    at fulfilled (/nix/store/ffxw5dysivcsw0y18fysxl255rkjyjdq-deezer-desktop-7.1.70/share/deezer-desktop/resources/app.asar/build/main.js:2836:26)
(Use `electron --trace-warnings ...` to show where the warning was created)
(node:138859) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
^C

The only solution is to edit the app.asar because NixOS packages are readonly so it is not possible to edit Electron to symlink the file without rebuilding it (and go back to a similar of the initial derivation).

So I created a patch to the original app here to add the optional possibility to override the process.resourcesPath when loading the systray icon whithout breaking Deezer.

I tested it and it is solving the error.

If this patch is accepted and my Nixpkgs derivation PR too, the app will then be available on Nixpkgs for all NixOS users with your credits (because it is just a wrap) with the command nix-shell -p deezer-desktop or by adding it to their NixOS configuration.nix or Nix Flakes.

Thank you for your time and feel free to make suggestions on this PR if needed.

Copy link
Collaborator

@josselinonduty josselinonduty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny detail, I think it would be better to name the patch "override-resources-path"
Otherwise, LGTM

@josselinonduty
Copy link
Collaborator

Hey,

The content of the patch looks good to me; I am not familiar with nix-related stuff but it seems to be a reasonable approach to solve your upstream issue.

@FelixLusseau FelixLusseau force-pushed the feature/add-resource-path-env-variable-override branch 2 times, most recently from 987a7e0 to 5afe413 Compare February 22, 2026 11:27
@FelixLusseau FelixLusseau force-pushed the feature/add-resource-path-env-variable-override branch from 5afe413 to 61e2049 Compare February 22, 2026 11:28
@josselinonduty josselinonduty merged commit b254780 into aunetx:master Feb 22, 2026
1 check passed
@FelixLusseau
Copy link
Contributor Author

Hi

Thank you for the feedback. I renamed the patch.

Finally, to build the Nix package, I only use the asar, the systray.png, the svg and the .desktop.

Maybe, could it be possible to publish an additional .tar.xz with only that on releases ?

@FelixLusseau
Copy link
Contributor Author

Thank you for the approval and merge too 🙏

@josselinonduty
Copy link
Collaborator

I am waiting for an upstream deezer update to create a release (with your patch). it usually takes 1 or 2 weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants