| 5 May 2024 |
Winter | yes, but you'll need to package your project first. there are various pnpm nix things that work, but i can really only vouch for the npm tooling being the most resistant to all of the awful hacks that is the node.js ecosystem. | 16:03:35 |
Tumble | do i delete the pnpm lock file and turn it into an npm project? | 16:04:14 |
Winter | if you want | 16:04:42 |
Tumble | does the npm tooling only work with npm project as opposed to a pnpm project?? | 16:05:22 |
Winter | correct | 16:05:33 |
Winter | the npm tooling only works with projects that have an npm lock file | 16:05:47 |
Tumble | wait, do i have to produce a binary? | 16:13:31 |
Winter | no | 16:15:26 |
Winter | the npm tooling will automatically produce a wrapper in $out/bin if your package.json is configured properly | 16:15:45 |
Tumble | nix build puts everything into result/lib/node_modules/(name)
but nix run tries to run /nix/store/.../bin/(name) which doesnt exist | 17:01:53 |
Tumble | ok figured it out | 17:19:30 |
Tumble | i searched github for a repo that has both buildNpmPackage and dontNpmBuild
https://github.com/ALT-F4-LLC/kickstart.nix/tree/f6385349c4dff04e3090559ff553492abd6f7e2d/template/nodejs-backend | 17:20:25 |
Tumble | and then saw that had a "bin" property in package.json | 17:20:40 |
Tumble | so i tried that and it worked | 17:20:44 |
Tumble | its just i couldnt figure out what Flags to pass to makeWrapper, added to executable calling the generated .js with node as an interpreter. These scripts are defined in package.json meant | 17:22:56 |
| 6 May 2024 |
purepani | In reply to @purepani:matrix.org how does that bug not make yarn-berry effectively useless to anyone So, apparently this is at least somewhat intended, or at least intentionally not guaranteed: https://yarnpkg.com/cli/install.
First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ). Specifically, they say Note that running [yarn install] is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
The issue is that if the repos don't use zero-install, either by choice, or just because they don't realize that it's a thing, there's no way to get any type of reproducibility since the integrety hashes aren't stored.
| 02:18:01 |
purepani | In reply to @purepani:matrix.org how does that bug not make yarn-berry effectively useless to anyone * So, apparently this is at least somewhat intended, or at least intentionally not guaranteed: https://yarnpkg.com/cli/install.
First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ). Specifically, they say Note that running [yarn install] is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
The issue is that if the repos don't use zero-install, either by choice, or just because they don't realize that it's a thing, there's no way to get any type of reproducibility since the integrety hashes aren't stored.
| 02:18:20 |
purepani | * So, apparently this is at least somewhat intended, or at least intentionally not guaranteed: https://yarnpkg.com/cli/install.
First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ). Specifically, they say Note that running [yarn install] is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
The issue is that if the repos don't use zero-install, either by choice, or just because they don't realize that it's a thing, there's no way to get any type of reproducibility since the integrety hashes aren't stored.
| 02:18:26 |
purepani | * So, apparently this is at least somewhat intended, or at least intentionally not guaranteed: https://yarnpkg.com/cli/install.
First the package manager will resolve your dependencies. The exact way a dependency version is privileged over another isn't standardized outside of the regular semver guarantees. If a package doesn't resolve to what you would expect, check that all dependencies are correctly declared (also check our website for more information: ).
Specifically, they say
Note that running [yarn install] is not part of the recommended workflow. Yarn supports zero-installs, which means that as long as you store your cache and your .pnp.cjs file inside your repository, everything will work without requiring any install right after cloning your repository or switching branches.
The issue is that if the repos don't use zero-install, either by choice, or just because they don't realize that it's a thing, there's no way to get any type of reproducibility since the integrety hashes aren't stored.
| 02:18:32 |
| dayvidpham joined the room. | 05:39:41 |
| 7 May 2024 |
dayvidpham | Hello, just wondering what the process is for building my project locally from my Flake output.
I think the problem is how Flakes handle files in .gitignore? I have a dist/ folder that is generated via Webpack/Babel at build-time, and it is currently gitignore'd. Things work fine if I take it out of the .gitignore file and run git add dist/.
When I don't do that, the build fails with message: error: getting status of '/nix/store/miap1bv0r73waw5g52ln2gnqjq8848yl-source/dist': No such file or directory
I try to build the package using npmBuildPackage, which runs the npm run build script by default in the buildPhase. This is fine and it should use webpack/babel to produce a dist/ directory.
I don't define any custom buildPhase, but I do define a custom installPhase which is simply:
installPhase = ''
runHook preInstall
cp -r ./dist $out/dist
runHook postInstall
'';
Any ideas on how to get this to work? | 08:05:28 |
dayvidpham | * Hello, just wondering what the process is for building my project locally from my Flake output.
I think the problem is how Flakes handle files in .gitignore? I have a dist/ folder that is generated via Webpack/Babel at build-time, and it is currently gitignore'd. Things work fine if I take it out of the .gitignore file and run
$ git add dist/
$ nix build
When I don't do that, the build fails with message: error: getting status of '/nix/store/miap1bv0r73waw5g52ln2gnqjq8848yl-source/dist': No such file or directory
I try to build the package using npmBuildPackage, which runs the npm run build script by default in the buildPhase. This is fine and it should use webpack/babel to produce a dist/ directory.
I don't define any custom buildPhase, but I do define a custom installPhase which is simply:
installPhase = ''
runHook preInstall
cp -r ./dist $out/dist
runHook postInstall
'';
Any ideas on how to get this to work? | 08:06:12 |
dayvidpham | * Hello, just wondering what the process is for building my project locally from my Flake output.
I think the problem is how Flakes handle files in .gitignore? I have a dist/ folder that is generated via Webpack/Babel at build-time, and it is currently gitignore'd. Things work fine if I take it out of the .gitignore file and run
$ git add dist/
$ nix build
When I don't do that, the build fails with message: error: getting status of '/nix/store/miap1bv0r73waw5g52ln2gnqjq8848yl-source/dist': No such file or directory
I try to build the package using npmBuildPackage, which runs the npm run build script by default in the buildPhase. This is fine and it should use webpack/babel to produce a dist/ directory.
I don't define any custom buildPhase, but I do define a custom installPhase which is simply:
installPhase = ''
runHook preInstall
mkdir -p $out/
cp -r ./dist $out/dist
runHook postInstall
'';
Any ideas on how to get this to work? | 08:08:30 |
Cobalt | You shouldn't have to check in `dist` into git. Are you sure you're build phase is working? Maybe try debugging in your installPhase with ```
ls -lah
exit 2
```
Alternatively, step through the derivation with `nix develop`> | 08:28:35 |
Cobalt | * You shouldn't have to check in `dist` into git. Are you sure you're build phase is working? Maybe try debugging in your installPhase with
```
ls -lah
exit 2
```
Alternatively, step through the derivation with `nix develop` | 08:28:43 |
dayvidpham | Ah, wow thanks. This made me realise that it was indeed not Nix that was the problem-- somebody defined the dist/ folder as a dev dependency in the package.json file 😅 | 10:00:14 |
dayvidpham | So then in the build step, Nix would look for it and wouldn't be able to find it 💀 | 10:00:46 |
| @gilligan:matrix.org rejected invite. | 18:01:34 |
| 9 May 2024 |
| @julia:the-apothecary.club changed their profile picture. | 05:40:02 |
| 10 May 2024 |
| Winter changed their display name from Winter to Winter (test). | 13:33:56 |