I’m trying to use yarn-plugin-nixify to write a flake.nix for a project at work. (An elm project that uses yarn to deal with JS dependencies.)
I’ve gotten everything to work fine on my machine, but building fails on my colleague’s machine and in CI with a message of
$ yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]
Packing @JohanWinther/svg2png@https://github.com/JohanWinther/npm-svg2png.git#commit=fad3fc7b89612db7a7fff71d37cd5fa93ef8602c from sources
No package manager configuration detected; defaulting to Yarn
Usage Error: Unrecognized or legacy configuration settings found: enableNixify - run "yarn config -v" to see the list of settings supported in Yarn (in <environment>)
$ yarn pack [--install-if-needed] [-n,--dry-run] [--json] [-o,--out #0]
according to this issue it happens when the plugin isn’t found. What it doesn’t mention is how to make it be found
Has anyone else seen this, and have a solution?
Alternatively, are there other ways to package a project using yarn+elm?
to install the plugin at your collegues’s computer?
2. Do you/they run NixOs or another distribution?
3. Is yarn recent enough? Yarn >= 3.1.0 or >= 4.0.0.
Second on dream2nix. I’ve used it extensively to package extremely complex yarn-based monorepos with workspaces and a variety of other off use cases, with close to 100% success rate with nodejs-based packages. The nodejs ecosystem is pretty much solved for dream2nix. It has support for both pure (package-lock.json, yarn.lock) and impure translations and provides many paths to solve various problems, such as package overrides, dependency injections, building without devDependencies (so build from the outside with nix instead), etc.
No, I thought that since yarn records what plugins are installed and where they come from that would be handled automatically. Especially since I’ve checked in the change to .yarnrc.yml as well as the plugin file itself, .yarn/plugins/yarn-plugin-nixify.cjs. Maybe that’s not the case, but then I’m not really sure how to handle the Catch 22 that arises
To install the plugin one needs a dev environment, i.e. to run nix develop, but
in order to get a dev environment one has to have the plugin installed.
Neither of us use NixOS.
Yes, it’s version 3.2 of Yarn.
No, I’ve never tried dream2nix, never even heard of it before, to be honest. Unfortunately I can’t make out how to use it at all though. It mentions nothing about Yarn and I don’t know enough about the JS ecosystem to understand if any of the existing modules would be useful to me
I don’t think we have strong reasons for it. It’s just what is there now, and as I don’t know the first thing about JS packaging/building I thought I’d stick to it. I mean, “how bad can it be”? Apparently plenty bad
If possible, could you run your project in a “non-nix environment”? So you’ll know if it comes from yarn / project or nix.
As @tobiasBora mentioned, the plugin itself may be missing.
Have you tried to temporarily push all .yarn to your remote?
I would usually commit .yarn/releases and .yarn/plugins or create a npmpost-install script to install these on yarn install.
Declaring in yarnrc.yml alone doesn’t install theses on e.g yarn install.
That also locks yarn and plugins versions (and avoid un-wanted upgrades).
Any chances that your colleague and you are using a different IDE / editor?
Some may require additional configurations to work well with yarn.
e.g VS code will throw some errors, extensions as well unless nodeLinker: node-modules is set
I’m pretty sure this is an issue with the setup of Yarn and the flake-ification of that. We’re not involving any IDEs or anything, only running nix build . and nix develop so far.
Anyway, I think I’ll do what @tobiasBora suggests and ditch Yarn completely. I started down the route of removing it and using npm instead and I have almost all things working already, just a few scripts that still mention yarn left to convert. Then I’ll see if flake-ifying becomes easier.