Help for a proper packaging workflow

I am trying to package a fmdserver which is written its frontend with next.js (pnpm) and backend written in go.

This is my current workflow:

I use grep in nixpkgs to search for something similar, then I found memos as template.

I copy this file and change it accordingly to fit the project.

Then I use a basic flake package outputs and use pkgs.callPackage and point to that above derivation nix file, then run nix build .#package to build the package. If I am lucky, it can be build without significant changes.

However I am not lucky this time. During the process it just throw some error message about the pnpm configuring process (pnpmConfigHook) > ERROR packages field missing or empty. I think this is because of some missing configurations or maybe the project directory structure is not the same as memos. But I have no idea whats going on.

Sometimes I can package some software like this, but I think it is just highly depends on luck.

Can I go inside the shell of building process to see the file structure and manually apply those phases to see what actually happened (file or directories created) before and after those phases?

What it the proper way to do this? thanks!

1 Like

It’s a pnpm bug or configuration problem in the project your are trying to build, depending on who you would rather blame. It should be fixed to my knowledge but maybe an older pnpm version is used.

In general a good first step for tackling problems like that is to learn more about the build systems used.

Thanks, that’s the problem I pinnen to use pnpm_9, after switched to pnpm_10 thats fine. And I am able to solve the path issue by going into the shell with nix develop .#package and follow the step 5. in Packaging/Tutorial - Official NixOS Wiki

Thanks!

1 Like