Skip to content

Build go module with pnpm deps #358844

@martinetd

Description

@martinetd

Describe the bug

I tried to build rmfakecloud (a go app, with since the latest version a pnpm web ui component) in #358324 in a single derivation but that didn't go so well.

Steps To Reproduce

Steps to reproduce the behavior:

  1. checkout https://github.com/martinetd/nixpkgs/commits/rmfakecloud_gopnpm/
  2. fail to build rmfakecloud: nix -L build -f . rmfakecloud
...
Error: 'pnpmDeps' must be set when using pnpmConfigHook
...

Additional context

It fails because the pnpmDeps / pnpmRoot attributes defined in buildGoModule arguments aren't present in the final derivation.

I could build by patching go module like this:

diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix
index 3a3ae71de508..3e063f5f7126 100644
--- a/pkgs/build-support/go/module.nix
+++ b/pkgs/build-support/go/module.nix
@@ -81,7 +81,7 @@ in
 
     nativeBuildInputs = (finalAttrs.nativeBuildInputs or [ ]) ++ [ go git cacert ];
 
-    inherit (finalAttrs) src modRoot;
+    inherit (finalAttrs) src modRoot pnpmDeps pnpmRoot;
     inherit (go) GOOS GOARCH;
     inherit GO111MODULE GOTOOLCHAIN;
 

But it's rather unsightly 😅

Perhaps there is a way to inherit all attributes from the argument?

Notify maintainers

buildGoModules itself has no maintainer... @NixOS/golang ?
For the pnpm side, @Scrumplex @gepbird

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions