For modern versions of Yarn, aka Yarn Berry, the preferred installation is through Corepack, and Corepack is included by default with Node.js installs (>=16.10). See https://yarnpkg.com/getting-started/install
This is what I've tried to do corepack enable
in default.nix
, but it doesn't work.
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "dev";
dontUnpack = true;
buildInputs = [ nodejs-17_x ];
postPhases = ''
corepack enable
'';
}