diff --git a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix index 81d4a36a869..3b30e2a8af0 100644 --- a/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix +++ b/pkgs/development/tools/yarn2nix-moretea/yarn2nix/default.nix @@ -74,6 +74,7 @@ in rec { preBuild ? "", postBuild ? "", workspaceDependencies ? [], # List of yarn packages + packageResolutions ? {}, }: let extraNativeBuildInputs = @@ -98,7 +99,7 @@ in rec { workspaceJSON = pkgs.writeText "${name}-workspace-package.json" - (builtins.toJSON { private = true; workspaces = ["deps/**"]; }); # scoped packages need second splat + (builtins.toJSON { private = true; workspaces = ["deps/**"]; resolutions = packageResolutions; }); # scoped packages need second splat workspaceDependencyLinks = lib.concatMapStringsSep "\n" (dep: '' @@ -176,6 +177,8 @@ in rec { packageGlobs = if lib.isList package.workspaces then package.workspaces else package.workspaces.packages; + packageResolutions = package.resolutions or {}; + globElemToRegex = lib.replaceStrings ["*"] [".*"]; # PathGlob -> [PathGlobElem] @@ -223,7 +226,7 @@ in rec { inherit name; value = mkYarnPackage ( builtins.removeAttrs attrs ["packageOverrides"] - // { inherit src packageJSON yarnLock workspaceDependencies; } + // { inherit src packageJSON yarnLock packageResolutions workspaceDependencies; } // lib.attrByPath [name] {} packageOverrides ); }) @@ -245,6 +248,7 @@ in rec { extraBuildInputs ? [], publishBinsFor ? null, workspaceDependencies ? [], # List of yarnPackages + packageResolutions ? {}, ... }@attrs: let @@ -264,7 +268,7 @@ in rec { preBuild = yarnPreBuild; postBuild = yarnPostBuild; workspaceDependencies = workspaceDependenciesTransitive; - inherit packageJSON pname version yarnLock offlineCache yarnFlags pkgConfig; + inherit packageJSON pname version yarnLock offlineCache yarnFlags pkgConfig packageResolutions; }; publishBinsFor_ = unlessNull publishBinsFor [pname]; @@ -298,7 +302,7 @@ in rec { '') workspaceDependenciesTransitive; - in stdenv.mkDerivation (builtins.removeAttrs attrs ["yarnNix" "pkgConfig" "workspaceDependencies"] // { + in stdenv.mkDerivation (builtins.removeAttrs attrs ["yarnNix" "pkgConfig" "workspaceDependencies" "packageResolutions"] // { inherit src pname; name = baseName;