!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

203 Members
58 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
7 May 2024
@dayvidpham:envs.net@dayvidpham:envs.net *

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
@c0ba1t:matrix.orgCobaltYou 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
@c0ba1t:matrix.orgCobalt* 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:envs.net@dayvidpham:envs.net 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:envs.net@dayvidpham:envs.netSo then in the build step, Nix would look for it and wouldn't be able to find it 💀10:00:46
@gilligan:matrix.org@gilligan:matrix.org rejected invite.18:01:34
9 May 2024
@julia:the-apothecary.club@julia:the-apothecary.club changed their profile picture.05:40:02

Show newer messages


Back to Room ListRoom Version: 6