Discourse package fails to build through nix-shell

Attempted to download and build the discourse nixpkg but it failed due to a seeming pnpm dependency error:

 ERR_PNPM_INVALID_DEPENDENCY_NAME  Refusing to place a dependency under /build/source/frontend/discourse-types/node_modules with the invalid alias "@types/@glimmer__component"

ERROR: pnpm failed to install dependencies

If you see ERR_PNPM_NO_OFFLINE_TARBALL above this, follow these to fix the issue:
1. Set pnpmDeps.hash to "" (empty string)
2. Build the derivation and wait for it to fail with a hash mismatch
3. Copy the 'got: sha256-' value back into the pnpmDeps.hash field

If you see ERR_PNPM_LOCKFILE_CONFIG_MISMATCH above this, try changing the pnpm version
Found 'pnpm' with version '10.34.4'

error: Cannot build '/nix/store/k90f0nxqhlyb1bym9lg5xl6pfjz4vamf-discourse-assets-2026.1.4.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/biwwabb1xl58v4ywqmmc7d4vm0sl78q3-discourse-assets-2026.1.4-node_modules
         /nix/store/jsbd94c63h63yq5xvrp27m5l1sg6667c-discourse-assets-2026.1.4-generated
         /nix/store/n278iw1v8kzswvwm8f6n6g15gkw6wb0q-discourse-assets-2026.1.4-frontend
         /nix/store/qnxglj6z2n8fn46af9rp7161634brcgk-discourse-assets-2026.1.4
       Last 25 log lines:
       > Progress: resolved 1909, reused 1263, downloaded 0, added 0
       > Progress: resolved 1909, reused 1907, downloaded 0, added 65
       > Progress: resolved 1909, reused 1909, downloaded 0, added 435
       > Progress: resolved 1909, reused 1909, downloaded 0, added 530
       > Progress: resolved 1909, reused 1909, downloaded 0, added 672
       > Progress: resolved 1909, reused 1909, downloaded 0, added 838
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1036
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1175
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1464
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1767
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1907
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1908
       > Progress: resolved 1909, reused 1909, downloaded 0, added 1909, done
       >  ERR_PNPM_INVALID_DEPENDENCY_NAME  Refusing to place a dependency under /build/source/frontend/discourse-types/node_modules with the invalid alias "@types/@glimmer__component"
       >
       > ERROR: pnpm failed to install dependencies
       >
       > If you see ERR_PNPM_NO_OFFLINE_TARBALL above this, follow these to fix the issue:
       > 1. Set pnpmDeps.hash to "" (empty string)
       > 2. Build the derivation and wait for it to fail with a hash mismatch
       > 3. Copy the 'got: sha256-' value back into the pnpmDeps.hash field
       >
       > If you see ERR_PNPM_LOCKFILE_CONFIG_MISMATCH above this, try changing the pnpm version
       > Found 'pnpm' with version '10.34.4'
       >
       For full logs, run:
         nix log /nix/store/k90f0nxqhlyb1bym9lg5xl6pfjz4vamf-discourse-assets-2026.1.4.drv
error: Cannot build '/nix/store/9n8grwvci4gd2c64i9wm5ggw5v4r63xf-discourse-2026.1.4.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/l9xhbd5scihfln5jr9vh1c6l4xznaall-discourse-2026.1.4
error: Build failed due to failed dependency

Didn’t quite see this issue anywhere and thought you all might like to know

The thing is, only Debian/Ubuntu are supported, not Nix. Is this for a development environment or for production?

this is just downloading the discourse package from nixpkgs using the nix package manager. Derivations work by essentially cloning and building a package directly from the source.

I was just ephmerally installing a package like I would any other nixOS. Not specifically for dev or production, really I wanted to see if I could use discourse in a cli. My tui browser won’t display some of the UI so I thought I’d test drive the nixpkg and see if the UX was more amenable.

Tried a simple download/build via nix and got the aforementioned error

Interesting. I believe the package isn’t officially by Discourse. A quick glance at the Maintainers does not list any member of the Discourse team that I have heard of. Plus, no Documentation about this AFAIK.

For reference: this plugin I think

ah yes that is the nixpkg maintainer(s)

the actual source is in the `let in` block

line 55:

let
  version = "2026.1.4";

  src = fetchFromGitHub {
    owner = "discourse";
    repo = "discourse";
    rev = "v${version}";
    sha256 = "sha256-kQYDKZIMsWByuCZQfUlwhoIew5QykVylRMh6xvrHIBY=";
  };
in
# ...

so it’s sourcing from `https://github.com/discourse/discourse\` and building version `2026.1.4`. The rest of the derivation is basically just build steps, where to put files, what to do with certain build errors …etc

that `src` parameter is kind of like a variable in that it is propagated down through the rest of the derivation

Also you don’t need to commit to the full nixOS to test this

the nix package manager is available for nearly any machine

`nix-shell -p discourse`

where the `nix-shell` starts a shell where whatever package(s), `-p`, are now available on the system. once the shell is closed those packages are no longer installed

I don’t have an apt analogy to describe nix as a concept but if water shapes itself to fit it’s container, nix is a container that shapes itself to fit it’s contents. The problem `nix` seeks to solve is “works on my machine” in that, if the software compiles and runs, it will compile and run via nix.

testing to see if this thread has been locked as I can’t see one of my most recent edits.

maybe the edit needs to be approved to display in the post

the thread is not locked and we are enjoying the topic and learning. Thank you for your contribution and welcome to Meta :+1:

no worries! thanks for the clarification.

The reason I suspected some approval process is because I’d made this edit and didn’t see it come up on my end:

I still see just the text on the left side

E: it just appeared

Thanks for the report! I took a look, and this appears to be a pnpm version mismatch in the Nix package rather than a problem with the dependency hash.

Discourse v2026.1.4 declares pnpm@10.28.0, while the Nix expression uses the moving pnpm_10 package, which currently resolves to 10.34.4. That newer pnpm version rejects some dependency aliases used by this Discourse release.

The likely Nixpkgs fix is to pin the derivation to an older compatible pnpm, possibly the existing pnpm_10_29_2 package, or exactly 10.28.0 and then update pnpmDeps.hash if necessary.

Since the Nix package is community-maintained, that fix would need to be made in Nixpkgs, but hopefully this points the maintainers in the right direction.

I may have jumped the gun on marking this solved as I haven’t actually tested that lol

Nixpkgs allows for overlays and overrides of it’s packages locally. I can try to implement those changes to the derivation myself when I get some time and report back my findings

This is as far as I got:

let
  nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-26.05";
  pkgs = import nixpkgs {
    config = { };
    overlays = with pkgs; [
      (final: prev: {
        discourse = prev.discourse.override (oa: {
          pnpm_10 = oa.pnpm_10.overrideAttrs (_: {
            src = fetchFromGitHub {
              owner = "pnpm";
              repo = "pnpm";
              rev = "ea870c786fc74c99bf9de644c78453b4d25a7d59";
              hash = "sha256-g+TjAW1SGuEXh04RnGZOQTLkJTHs/3zyCp/P+MzBn4c=";
            };
          });
        });

      })
    ];
  };
in

pkgs.mkShellNoCC {
  packages = with pkgs; [
    # for debug
    discourse
  ];
}

error:

Running phase: unpackPhase
unpacking source archive /nix/store/ci631zzm890b2dzsrxxxrg15qpbac6jy-source
source root is source
rm: cannot remove 'package/dist/vendor': No such file or directory
error: Cannot build '/nix/store/lq23pl8ycyf8myl9mynwzx9a2f2miywv-pnpm-10.34.0.drv'.
       Reason: builder failed with exit code 1.
       Output paths:
         /nix/store/kf62vww5jdfpr32qgxhz4qv9dkfdb0pf-pnpm-10.34.0
       Last 5 log lines:
       > structuredAttrs is enabled
       > Running phase: unpackPhase
       > unpacking source archive /nix/store/ci631zzm890b2dzsrxxxrg15qpbac6jy-source
       > source root is source
       > rm: cannot remove 'package/dist/vendor': No such file or directory
       For full logs, run:
         nix log /nix/store/lq23pl8ycyf8myl9mynwzx9a2f2miywv-pnpm-10.34.0.drv
error: Cannot build '/nix/store/1hi18g4r0gmmlnj059irx91grry7ymv7-discourse-assets-2026.1.4.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/bw2pzh74fbp0wkn9f4b2bf2p6lwcva3d-discourse-assets-2026.1.4
         /nix/store/kqnrdh18f4pn87rpzk2af0d18xcvbj7k-discourse-assets-2026.1.4-generated
         /nix/store/mcbvqw0y8r3as9zrjmrq7pc32n64bj2r-discourse-assets-2026.1.4-frontend
         /nix/store/my9x48zhzzqi2w8rriww6qm4v9iaxxhx-discourse-assets-2026.1.4-node_modules
error: Cannot build '/nix/store/05ffysx25hfzw34km225d2krpnifwj75-discourse-2026.1.4.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/2b1pvnvln95dx7rxr88kc5b9g24x45dr-discourse-2026.1.4

Apparently the logs will just show the wrong build as if I didn’t overwrite it which is super helpful. It’s complaining about some `package/dist/vendor` file not being created.

yeah this is probably a thing best left to the maintainers