From 82d30e0d4fb1275fc148498eaafe42bc04966733 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Sat, 15 Mar 2025 18:02:51 +0100 Subject: [PATCH] buildVscodeMarketplaceExtension: support `finalAttrs` through `lib.extendMkDerivation` --- .../vscode/extensions/vscode-utils.nix | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix index 6d6b1d294fa1..ad1abe7f9402 100644 --- a/pkgs/applications/editors/vscode/extensions/vscode-utils.nix +++ b/pkgs/applications/editors/vscode/extensions/vscode-utils.nix @@ -75,30 +75,32 @@ let fetchVsixFromVscodeMarketplace = mktplcExtRef: fetchurl (import ./mktplcExtRefToFetchArgs.nix mktplcExtRef); - buildVscodeMarketplaceExtension = - a@{ - name ? "", - src ? null, - vsix ? null, - mktplcRef, - ... - }: - assert "" == name; - assert null == src; - buildVscodeExtension ( - (removeAttrs a [ - "mktplcRef" - "vsix" - ]) - // { + buildVscodeMarketplaceExtension = lib.extendMkDerivation { + constructDrv = buildVscodeExtension; + excludeDrvArgNames = [ + "mktplcRef" + "vsix" + ]; + extendDrvArgs = + finalAttrs: + { + name ? "", + src ? null, + vsix ? null, + mktplcRef, + ... + }: + assert "" == name; + assert null == src; + { + inherit (mktplcRef) version; pname = "${mktplcRef.publisher}-${mktplcRef.name}"; - version = mktplcRef.version; src = if (vsix != null) then vsix else fetchVsixFromVscodeMarketplace mktplcRef; vscodeExtPublisher = mktplcRef.publisher; vscodeExtName = mktplcRef.name; vscodeExtUniqueId = "${mktplcRef.publisher}.${mktplcRef.name}"; - } - ); + }; + }; mktplcRefAttrList = [ "name"