nix-shell을 통해 Discourse 패키지가 빌드되지 않음

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:

걱정 마세요! 설명해 주셔서 감사합니다.

승인 과정이 있다는 것을 의심했던 이유는 제가 이 편집을 했는데 제 화면에는 나타나지 않았기 때문입니다:

여전히 왼쪽에 텍스트만 보입니다

E: 방금 나타났네요

리포트 감사합니다! 확인해 본 결과, 이는 의존성 해시 문제보다는 Nix 패키지에서 pnpm 버전 불일치로 보입니다.

Discourse v2026.1.4pnpm@10.28.0을 선언하고 있지만, 해당 Nix 표현식은 현재 10.34.4로 해석되는 이동하는 pnpm_10 패키지를 사용하고 있습니다. 이 더 새로운 pnpm 버전은 해당 Discourse 릴리스에서 사용되는 일부 의존성 별명을 거부합니다.

Nixpkgs의 가능한 수정 방법은 파생(derivation)을 기존 pnpm_10_29_2 패키지나 정확히 10.28.0과 같은 더 오래된 호환 가능한 pnpm 버전으로 고정하는 것입니다. 필요에 따라 pnpmDeps.hash도 업데이트해야 할 수 있습니다.

Nix 패키지는 커뮤니티에서 관리되므로 이 수정은 Nixpkgs에서 이루어져야 하지만,hopefully 이 정보가 유지보수자들에게 올바른 방향을 제시해 줄 것으로 기대합니다.

아직 실제로 테스트를 해보지 않았는데도 해결로 표시한 건 좀 성급했네요, 하하.

Nixpkgs는 로컬에서 패키지 오버레이와 오버라이드를 지원합니다. 시간이 나면 해당 변경 사항을 내보출(derivation)에 직접 적용해 보고 결과를 공유하겠습니다.

여기까지 진행했습니다:

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
  ];
}

오류:

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

로그는 내가 오버라이드하지 않은 것처럼 잘못된 빌드를 표시하는 것 같습니다. 정말 유용하군요. package/dist/vendor 파일이 생성되지 않는다고 불평하고 있습니다.

네, 이건 유지보수자에게 맡기는 것이 가장 좋은 문제일 것 같습니다.

nixpkgs에는 1월 기준으로 꽤 오래된 버전의 Discourse가 포함되어 있어서 업데이트를 위한 PR을 열었습니다. nixpkgs에 기여한 적이 없어서 어떻게 될지 지켜봐야겠습니다.

@fuguesoft 업데이트된 Discourse nixpkg가 병합된 것 같습니다. 시도해 보시려면 참고해 주세요.