!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

205 Members
59 Servers

Load older messages


SenderMessageTime
10 Nov 2023
@lily:lily.flowersLily Foster(and you shouldn't need modules if you use rollup, right?)22:32:29
@lily:lily.flowersLily Foster i'm pretty sure buildNpmPackage will do the right thing without trying to recreate what these docs are suggesting 22:33:24
@lily:lily.flowersLily Foster you might just need to add build as a dir for npm package in your package.json 22:33:35
@lily:lily.flowersLily Fosterand then it should handle everything else22:33:42
@lily:lily.flowersLily Foster * and then buildNpmPackage should handle everything else22:33:47
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
you might just need to add build as a dir for npm package in your package.json
so what could I omit in buildNpmPackage?
22:34:03
@lily:lily.flowersLily Foster these docs are confusing because if it's using rollup, why is it saying you need node_modules? 22:34:28
@lily:lily.flowersLily Fosterunless i'm misremembering what rollup does22:34:35
@lily:lily.flowersLily Foster also that buildInputs is likely not doing anything either 22:35:00
@lily:lily.flowersLily Foster

this might just be fine:

buildNpmPackage {
  src = ./.;
  npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
  installPhase = ''
    cp -r build $out
  '';
  nodejs = nodejs_20;
}
22:35:37
@lily:lily.flowersLily Foster actually maybe move build somewhere more useful 22:36:09
@c0ba1t:matrix.orgCobalt
In reply to @lily:lily.flowers

this might just be fine:

buildNpmPackage {
  src = ./.;
  npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
  installPhase = ''
    cp -r build $out
  '';
  nodejs = nodejs_20;
}
Isn't this one missing the {pre,post}install hooks?
22:36:21
@lily:lily.flowersLily Foster
In reply to @c0ba1t:matrix.org
Isn't this one missing the {pre,post}install hooks?
it is, yes. but it's an out-of-tree package so i didn't bother 😅
22:37:07
@peter-lustig:matrix.orgpeter-lustigdoes that nodejs even exist?22:37:09
@peter-lustig:matrix.orgpeter-lustigimage.png
Download image.png
22:37:10
@c0ba1t:matrix.orgCobaltIt does on 23.05 https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=nodejs22:37:36
@c0ba1t:matrix.orgCobalt* It does on 23.05: https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=nodejs22:37:50
@peter-lustig:matrix.orgpeter-lustig
In reply to @c0ba1t:matrix.org
It does on 23.05: https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=nodejs
yeah, but i have nerver seen it being used like this
22:38:02
@peter-lustig:matrix.orgpeter-lustigI guess I need pkgs.nodejs_2022:38:13
@lily:lily.flowersLily Foster
In reply to @lily:lily.flowers
actually maybe move build somewhere more useful

maybe something like this if you want a bin you can just execute

buildNpmPackage {
  src = ./.;
  npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
  nodejs = pkgs.nodejs_20;
  nativeBuildInputs = [ pkgs.makeWrapper ];
  installPhase = ''
    mkdir -p $out/lib/node_modules
    cp -r build $out/lib/node_modules/sveltepackage

    makeWrapper ${pkgs.nodejs-slim_20}/bin/node $out/bin/sveltepackage \
      --add-flags $out/lib/node_modules/sveltepackage
  '';
}
22:40:36
@lily:lily.flowersLily Foster (note you need to be on like nixpkgs master to get the nodejs arg on buildNpmPackage 22:40:54
@lily:lily.flowersLily Foster * (note you need to be on like nixpkgs master to get the nodejs arg on buildNpmPackage) 22:40:56
@lily:lily.flowersLily Foster(that was merged like ... yesterday)22:41:02
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
(note you need to be on like nixpkgs master to get the nodejs arg on buildNpmPackage)
ah okay, but isnt buildInputs = [ nodejs_20 ] dong the same
22:41:21
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
ah okay, but isnt buildInputs = [ nodejs_20 ] dong the same
because buildNpmPackage takes the nodejs you give it and sets up everything to use it
22:41:39
@lily:lily.flowersLily Foster putting a second nodejs in buildInputs won't do much 22:41:55
@lily:lily.flowersLily Foster (second because buildNpmPackage already adds the same nodejs that it set up) 22:42:11
@peter-lustig:matrix.orgpeter-lustigOkay, I also need this i guess In dev and preview, SvelteKit will read environment variables from your .env file (or .env.local, or .env.[mode], as determined by Vite.) In production, .env files are not automatically loaded. To do so, install dotenv in your project... npm install dotenv ...and invoke it before running the built app: node -r dotenv/config build22:43:09
@lily:lily.flowersLily Fosterwow that's a really complicated way to handle .env files....22:43:46
@peter-lustig:matrix.orgpeter-lustigahhhhhhhhhhhhhhhh why are deployments always so complicated22:44:07

Show newer messages


Back to Room ListRoom Version: 6