| 10 Nov 2023 |
peter-lustig | does that nodejs even exist? | 22:37:09 |
peter-lustig |  Download image.png | 22:37:10 |
Cobalt | It does on 23.05 https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=nodejs | 22:37:36 |
Cobalt | * It does on 23.05: https://search.nixos.org/packages?channel=23.05&from=0&size=50&sort=relevance&type=packages&query=nodejs | 22:37:50 |
peter-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 | I guess I need pkgs.nodejs_20 | 22:38:13 |
Lily 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 Foster | (note you need to be on like nixpkgs master to get the nodejs arg on buildNpmPackage | 22:40:54 |
Lily Foster | * (note you need to be on like nixpkgs master to get the nodejs arg on buildNpmPackage) | 22:40:56 |
Lily Foster | (that was merged like ... yesterday) | 22:41:02 |
peter-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 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 Foster | putting a second nodejs in buildInputs won't do much | 22:41:55 |
Lily Foster | (second because buildNpmPackage already adds the same nodejs that it set up) | 22:42:11 |
peter-lustig | Okay, 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 build | 22:43:09 |
Lily Foster | wow that's a really complicated way to handle .env files.... | 22:43:46 |
peter-lustig | ahhhhhhhhhhhhhhhh why are deployments always so complicated | 22:44:07 |
Lily Foster | one sec, i'll come up with an adjustment to include that | 22:44:13 |
Lily 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 |
Cobalt | You 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 setup | 22:47:45 |
Lily Foster | Yeah just don't use .env in production tbh | 22:48:40 |
Lily Foster | If you're running by like a systemd service, then you can set env vars there | 22:48:48 |
Lily 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 | that probably complicates stuff even more | 22:50:20 |
Lily Foster | i mean how are you running it now? | 22:51:17 |
peter-lustig | all these build scripts are so user unfriendly | 22:51:18 |
peter-lustig | only experts can know how to do stuff | 22:51:24 |
peter-lustig | like you | 22:51:26 |
daniel | 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 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 |