| 7 Jan 2024 |
Lily Foster | In reply to @pkolloch:matrix.org
Heyo everyone,
I'd like to tell nixpkgs's buildNpmPackage which node version to use: nodejs_21 in my case.
How can I do it?
I could override the nodejs arguement but it also references buildPackages (which obviously is rather hard to override) and fetchNpmDeps.
https://github.com/NixOS/nixpkgs/blob/43eec8711993f851dc4f5dec16c0cb2fdb2b1d3a/pkgs/build-support/node/build-npm-package/default.nix#L4
buildNpmPackage { ...; nodejs = nodejs_21; } | 19:03:51 |
@pkolloch:matrix.org | In reply to @lily:lily.flowers
buildNpmPackage { ...; nodejs = nodejs_21; } Thank you! https://github.com/NixOS/nixpkgs/blob/43eec8711993f851dc4f5dec16c0cb2fdb2b1d3a/pkgs/build-support/node/build-npm-package/default.nix#L46 | 19:05:17 |
| 9 Jan 2024 |
| samasaur joined the room. | 00:59:28 |
samasaur | Hi! I'm trying to package a NextJS NPM project with Nix, and I currently am able to build it on aarch64-darwin and x86_64-darwin, but not on Linux, and I really have no idea where to go from here | 01:00:29 |
samasaur | The project is https://github.com/Remote-Text/remote-text-client/tree/nix-flake | 01:01:04 |
samasaur | and the issue I get when building on x86_64-linux is
npm ERR! code 1
npm ERR! path /build/379k76sxq5hfcb5azx75c2k0y66q9p1i-source/node_modules/cypress
npm ERR! command failed
npm ERR! command sh -c node index.js --exec install
npm ERR! Installing Cypress (version: 12.7.0)
npm ERR!
npm ERR! [STARTED] Task without title.
npm ERR! The Cypress App could not be downloaded.
npm ERR!
npm ERR! Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
npm ERR!
npm ERR! Otherwise, please check network connectivity and try again:
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! URL: https://download.cypress.io/desktop/12.7.0?platform=linux&arch=x64
npm ERR! Error: getaddrinfo EAI_AGAIN download.cypress.io
npm ERR!
npm ERR! ----------
npm ERR!
npm ERR! Platform: linux-x64 (6.1.69)
npm ERR! Cypress Version: 12.7.0
npm ERR! [FAILED] The Cypress App could not be downloaded.
npm ERR! [FAILED]
npm ERR! [FAILED] Does your workplace require a proxy to be used to access the Internet? If so, you must configure the HTTP_PROXY environment variable before downloading Cypress. Read more: https://on.cypress.io/proxy-configuration
npm ERR! [FAILED]
npm ERR! [FAILED] Otherwise, please check network connectivity and try again:
npm ERR! [FAILED]
npm ERR! [FAILED] ----------
npm ERR! [FAILED]
npm ERR! [FAILED] URL: https://download.cypress.io/desktop/12.7.0?platform=linux&arch=x64
npm ERR! [FAILED] Error: getaddrinfo EAI_AGAIN download.cypress.io
npm ERR! [FAILED]
npm ERR! [FAILED] ----------
npm ERR! [FAILED]
npm ERR! [FAILED] Platform: linux-x64 (6.1.69)
npm ERR! [FAILED] Cypress Version: 12.7.0
npm ERR! Log files were not written due to an error writing to the directory: /nix/store/53jgj8pxhifcpqz5hf09j0i5jypngzll-remote-text-web-client-0.1.0-npm-deps/_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
| 01:02:08 |
samasaur | I tried adding pkgs.cypress to buildInputs and/or nativeBuildInputs, but neither seemed to fix the problem | 01:02:40 |
@julia:the-apothecary.club | I believe that darwin's nix config defaults to the sandbox being disabled, so that's probably why it builds there. (one could verify this assumption with --option sandbox true on macOS or --option sandbox false on Linux. | 01:09:40 |
@julia:the-apothecary.club | From googling, it looks like there's a CYPRESS_RUN_BINARY and CYPRESS_INSTALL_BINARY variable which allows you to set it to an existing path. | 01:13:10 |
samasaur | In reply to @julia:the-apothecary.club I believe that darwin's nix config defaults to the sandbox being disabled, so that's probably why it builds there. (one could verify this assumption with --option sandbox true on macOS or --option sandbox false on Linux. nix build . --sandbox still works on Darwin, so I think that's not it | 01:13:44 |
@julia:the-apothecary.club | * From googling, it looks like there's a CYPRESS_RUN_BINARY and CYPRESS_INSTALL_BINARY variable which allows you to set it to an existing path. (https://docs.cypress.io/guides/references/advanced-installation) | 01:13:47 |
@julia:the-apothecary.club | Yes, but it's disabled by default. | 01:13:52 |
samasaur | right but doesn't --sandbox enable it? so if it still builds with the sandbox, then that's not the issue? | 01:14:57 |
@julia:the-apothecary.club | ah. | 01:16:21 |
@julia:the-apothecary.club | In reply to @julia:the-apothecary.club From googling, it looks like there's a CYPRESS_RUN_BINARY and CYPRESS_INSTALL_BINARY variable which allows you to set it to an existing path. (https://docs.cypress.io/guides/references/advanced-installation) Yeah, you're right. I think this should still work though, cause the issue on Linux is trying to access the internet (which isn't possible in a sandbox). | 01:17:16 |
samasaur | so maybe set CYPRESS_INSTALL_BINARY=0 (to skip binary installs) and then set CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress? | 01:20:49 |
samasaur | will give it a shot | 01:20:58 |
@julia:the-apothecary.club | Here's someone else's package using cypress: https://github.com/NixOS/nixpkgs/blob/d405cc8e0e47f8c45f72729000395f3eb3f73a70/pkgs/servers/monitoring/uptime-kuma/default.nix#L24 | 01:22:19 |
@julia:the-apothecary.club | (there's a few of those) | 01:22:45 |
samasaur | thanks! | 01:23:18 |
samasaur | In reply to @samasaur:matrix.org so maybe set CYPRESS_INSTALL_BINARY=0 (to skip binary installs) and then set CYPRESS_RUN_BINARY=${pkgs.cypress}/bin/Cypress? also this appears to have worked! | 01:23:24 |
samasaur | based on that package you linked I would think that CYPRESS_RUN_BINARY is unnecessary but I will leave it in there | 01:23:54 |
@julia:the-apothecary.club | coolios. I guess mac must not download cypress? or do something different. which is kinda weird. | 01:24:09 |
samasaur | honestly i think you were right and it's a sandboxing thing. i cannot prove it but i vaguely recall seeing a similar error initially on mac and doing weird NPM stuff outside of nix until it worked. so maybe that's still having an impact | 01:25:29 |
@julia:the-apothecary.club | In reply to @samasaur:matrix.org
nix build . --sandbox still works on Darwin, so I think that's not it actually, is this with a clean nix store / new build
because npmDepsHash implies to me the npm deps get put to the store separately; it's not gonna try redownload if it's specified already. (not 100% on certain that's how it works, but I'd be surprised if it wasn't)
| 01:26:24 |
@julia:the-apothecary.club | In reply to @samasaur:matrix.org
nix build . --sandbox still works on Darwin, so I think that's not it * actually, is this with a clean nix store / new build?
because npmDepsHash implies to me the npm deps get put to the store separately; it's not gonna try redownload if it's specified already. (not 100% on certain that's how it works, but I'd be surprised if it wasn't)
| 01:26:29 |
samasaur | oh true | 01:26:49 |
samasaur | also despite it building on Linux, when i put it in a Docker image and tried to run the docker image, I still got exec format error | 01:27:17 |
samasaur | so something else is wrong | 01:27:30 |
@julia:the-apothecary.club | not particularly certain with docker things, what does file report? | 01:31:11 |