Request for help fixing Discourse in Nixpkgs

Hi!

Discourse recently started requiring building a ember-cli/yarn javascript project as part of building the assets.

I started a PR to upgrade Discourse but it seems that I cannot skip the ember-cli build even though there is an option to skip it, because when I skip it the Discourse admin console does not show the latest version is installed.

So, I am trying to build a yarn workspace and running an ember build command. I was able to build the workspace with

  emberAssets = mkYarnWorkspace {
    src = "${src}/app/assets/javascripts";
  };

But I don’t know how to set up an environment where I can run that ember build command.

Every time I try to package something in the Javascript ecosystem I find myself getting stuck. I’m looking for someone who knows Nix Javascript tools to do a screenshare call with me to help me figure this out.

Any takers?

Sincerely,
Ryan Mulligan

3 Likes

I see your pain. We had to resort to dream2nix to build some of our more complicated node packages, it seems to handle most of the stuff we throw at it.

I must agree that the node ecosystem is spinning out of control. Maybe the only way to keep this thing building is imperative docker containers!! The horror!

5 Likes

@dream2nix’ers (@matthewcroughan @DavHau ) here’s an initial attempt: GitHub - tomberek/discourse: A platform for community discussion. Free, open, simple.

3 Likes

Here’s my dream2nix attempt dream2nix · ryantm/discourse@c4fd259 · GitHub

The issue is there is a sub yarn project at app/assets/javascripts. I tried using the new dream2nix lib2 to enable project discovery (by just swapping lib with lib2 in the flake.nix), but I got an error:

> nix run .#resolve
error: attribute 'readDreamLock' missing

       at /nix/store/ngy44gqr8frj0wvzbhkpja888h9aihs6-source/src/default.nix:545:25:

          544|             dreamLockPath = getDreamLockPath project;
          545|             dreamLock = dlib.readDreamLock dreamLockPath;
             |                         ^
          546|             impure = isImpure project translator;
(use '--show-trace' to show detailed location information)
2 Likes

fixed via: fix: error on non-top-level workspace roots · nix-community/dream2nix@6d4b62b · GitHub

2 Likes

Don’t make use of .#resolve yet. That is still work in progress. But you should be able to build all the packages that contain a lock file or are part of a workspace with a lock-file.

2 Likes

@ryantm: this builds! GitHub - tomberek/nixpkgs at yarn_workspace Not sure what do do next. It requires extra support for workspaces.

nix build .#discourse.emberAssets

2 Likes

Nice work tom, the nix force is strong with you.

1 Like

My solution is here. Any help reviewing the PR is appreciated!

2 Likes