dream2nix
dream2nix copied to clipboard
Binary hashes are missing
Thanks first for this promising project… unfortunately I can't make it work. Here is a very basic project built on electron (just taken from the quickstart web page):
$ cd tmp && git clone https://github.com/tobiasBora/quickstart-electron
$ nix flake init -t github:nix-community/dream2nix#simple
$ nix eval --impure --raw --expr 'builtins.currentSystem' > ./nix_systems && git add ./nix_systems
$ nix flake show
$ nix build .#default
warning: Git tree '/tmp/quickstart-electron' is dirty
error: Electron binary hashes are missing for required version 19.0.9
Please add the hashes in the override below the origin of this error.
To get the hashes, execute:
/nix/store/x6qa4ickfvbagkp9zj86ac49s6ffghvb-nodejs/electron/print-hashes.sh 19.0.9
(use '--show-trace' to show detailed location information
$ /nix/store/x6qa4ickfvbagkp9zj86ac49s6ffghvb-nodejs/electron/print-hashes.sh 19.0.9
error: unable to download 'https://atom.io/download/electron/v19.0.9/node-v19.0.9-headers.tar.gz': HTTP error 403 ('Forbidden')
response body:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>W44G2TW1WQEQYV9Y</RequestId><HostId>ijUyhkPzI3jD7+MnmrB4A7amot/QQTZlsLMB/z6AQM7qoInwWb7pCRT+KT6Ym9JYzvv/sb7MDog=</HostId></Error>
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/cant-setup-development-with-electron-error-spawn-enoent/18497/5
The problem with the script receiving the electron binary hashes is fixed by now.
The hashes need to be added to this file: https://github.com/nix-community/dream2nix/blob/main/overrides/nodejs/default.nix#L180
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/cant-setup-development-with-electron-error-spawn-enoent/18497/7
Thanks, I can confirm that print-hash works but I'm not sure to understand where to write the overwrite: should I fork this project or can I somehow do that purely locally? Also any reason dream2nix does not come with this hash already?
Also meanwhile I tried to change the electron version to 20.0.1 (since I saw that it was in the list of hashes) in the package.json before running npm i --package-lock-only but it fails
$ nix build .#default
warning: Git tree '/tmp/quickstart-electron' is dirty
error: attribute 'electron_20' missing
at /nix/store/3akswl509msksq037fps8mzb5m66ba7z-source/src/subsystems/nodejs/builders/granular/default.nix:204:14:
203| then null
204| else pkgs."electron_${electronVersionMajor}".headers;
| ^
205|
Did you mean one of electron_10, electron_11, electron_12, electron_13 or electron_14?
(use '--show-trace' to show detailed location information)
any idea how to solve this?
Note that if I change the version to 14.2.0 it does work! :-D However I'd love to learn how to install an arbitrary version of electron and co.
Currently you need to fork dream2nix and update the hash entries in https://github.com/nix-community/dream2nix/blob/0131c22c369f8c4c661aea7a395e94669a7f5974/overrides/nodejs/default.nix#L180 We should add a better way to override these hashes though. Also we should add a script that updates the hashes of all minor versions automatically.
I see, thanks. And any idea why electron 20 is not working despite a hash entry? One can't use electron if it's not manually packaged into NixOs?
Yes, I think at least a package of the same major version must exist in nixpkgs, otherwise it won't work. We could improve that of course.
So does that mean that if I specify, say, version 20.1 and nixpkgs only packages version 20.0, then the project would use 20.0?
No, it means it would produce the error you posted above and not build anything. You probably just have to update the nixpkgs input of the dream2nix flake
Fixing issue https://github.com/nix-community/dream2nix/issues/268 will solve that problem
Thanks!