!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

203 Members
58 Servers

Load older messages


SenderMessageTime
10 Nov 2023
@lily:lily.flowersLily Fosterone sec, i'll come up with an adjustment to include that22:44:13
@lily:lily.flowersLily Foster
In reply to @peter-lustig:matrix.org
ahhhhhhhhhhhhhhhh why are deployments always so complicated
because projects like sveltekit are apparently really interested in making it that way 🫠
22:44:27
@c0ba1t:matrix.orgCobaltYou can get around it by producing a wrapper that sets the relevant vars, https://gitlab.cobalt.rocks/nix/proofbuddy.nix/-/blob/main/flake.nix?ref_type=heads#L121. It's not pretty but has been proven to work for our vite+turbopack and (previously) CRA setup22:47:45
@lily:lily.flowersLily FosterYeah just don't use .env in production tbh22:48:40
@lily:lily.flowersLily FosterIf you're running by like a systemd service, then you can set env vars there22:48:48
@lily:lily.flowersLily Foster
In reply to @lily:lily.flowers
Yeah just don't use .env in production tbh
(possible hot take, sorry 😅)
22:49:12
@peter-lustig:matrix.orgpeter-lustigthat probably complicates stuff even more22:50:20
@lily:lily.flowersLily Fosteri mean how are you running it now?22:51:17
@peter-lustig:matrix.orgpeter-lustigall these build scripts are so user unfriendly22:51:18
@peter-lustig:matrix.orgpeter-lustigonly experts can know how to do stuff22:51:24
@peter-lustig:matrix.orgpeter-lustiglike you22:51:26
@daniel:nopemail.orgdaniel https://nodejs.org/en/blog/release/v20.6.0

There is built-in support for env files. No need for dotenv
22:54:10
@lily:lily.flowersLily Foster
In reply to @daniel:nopemail.org
https://nodejs.org/en/blog/release/v20.6.0

There is built-in support for env files. No need for dotenv
oh neat!
22:54:50
@lily:lily.flowersLily Foster

so yeah i guess you could just change the makeWrapper to this:

    makeWrapper ${pkgs.nodejs-slim_20}/bin/node $out/bin/sveltepackage \
      --add-flags --env-file=.env \
      --add-flags $out/lib/node_modules/sveltepackage
22:55:53
@lily:lily.flowersLily Fosterif you reallyyy need to do complicated .env file stuff from the current dir22:56:08
@daniel:nopemail.orgdaniel I'm successfully deploying a SvelteKit project without issues using buildNpmPackage, can be seen here: https://github.com/danielalvsaaker/tf-viewer-net/blob/main/frontend/default.nix 22:56:11
@daniel:nopemail.orgdaniel * I'm successfully deploying a SvelteKit project without issues using buildNpmPackage, can be seen here for reference: https://github.com/danielalvsaaker/tf-viewer-net/blob/main/frontend/default.nix 22:56:55
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers

so yeah i guess you could just change the makeWrapper to this:

    makeWrapper ${pkgs.nodejs-slim_20}/bin/node $out/bin/sveltepackage \
      --add-flags --env-file=.env \
      --add-flags $out/lib/node_modules/sveltepackage
do I need that wrapper?
22:57:43
@lily:lily.flowersLily Fosteri guess you don't need it22:58:10
@daniel:nopemail.orgdaniel * I'm successfully packaging a SvelteKit project without issues using buildNpmPackage, can be seen here for reference: https://github.com/danielalvsaaker/tf-viewer-net/blob/main/frontend/default.nix 22:58:10
@lily:lily.flowersLily Fosteri assumed you wanted something to run it like the sveltekit docs were suggesting22:58:20
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
i assumed you wanted something to run it like the sveltekit docs were suggesting
basically, my goal is to just get it with inputs.sveltekit-package.${pkgs.system}.default; and it does all the stuff. I run it on nginx
22:59:51
@peter-lustig:matrix.orgpeter-lustigthen I would just set the proxypass and it communicates with the db and done23:00:20
@peter-lustig:matrix.orgpeter-lustigthat is the plan at least23:00:29
@lily:lily.flowersLily Foster What's it there? Like do you want a script to run it? (like the wrapper makes?) 23:01:44
@peter-lustig:matrix.orgpeter-lustig
In reply to @lily:lily.flowers
What's it there? Like do you want a script to run it? (like the wrapper makes?)
yes, I guess it needs to somehow run permanently. SvelteKit docs say: You can then start your app with this command: node build
23:03:25
@lily:lily.flowersLily Fosteryeah the wrapper would replace that23:03:57
@lily:lily.flowersLily Fosterand do that for you23:04:00
@lily:lily.flowersLily Fosterbut like, you'd still have to start the wrapper somehow23:04:16
@lily:lily.flowersLily FosterIf it's nixos, just making it a systemd service would be easiest, but otherwise you could come up with something else23:04:42

Show newer messages


Back to Room ListRoom Version: 6