mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-11 04:02:55 +03:00
parent
41de073c82
commit
66a6cd1d51
@ -5,6 +5,8 @@ let
|
||||
src,
|
||||
# Same as "Unique Identifier" on the extension's web page.
|
||||
# For the moment, only serve as unique extension dir.
|
||||
vscodeExtPublisher,
|
||||
vscodeExtName,
|
||||
vscodeExtUniqueId,
|
||||
configurePhase ? ''
|
||||
runHook preConfigure
|
||||
@ -23,7 +25,10 @@ let
|
||||
|
||||
name = "vscode-extension-${name}";
|
||||
|
||||
inherit vscodeExtUniqueId;
|
||||
passthru = {
|
||||
inherit vscodeExtPublisher vscodeExtName vscodeExtUniqueId;
|
||||
};
|
||||
|
||||
inherit configurePhase buildPhase dontPatchELF dontStrip;
|
||||
|
||||
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||
@ -54,9 +59,12 @@ let
|
||||
}: assert "" == name; assert null == src;
|
||||
buildVscodeExtension ((removeAttrs a [ "mktplcRef" "vsix" ]) // {
|
||||
name = "${mktplcRef.publisher}-${mktplcRef.name}-${mktplcRef.version}";
|
||||
version = mktplcRef.version;
|
||||
src = if (vsix != null)
|
||||
then vsix
|
||||
else fetchVsixFromVscodeMarketplace mktplcRef;
|
||||
vscodeExtPublisher = mktplcRef.publisher;
|
||||
vscodeExtName = mktplcRef.name;
|
||||
vscodeExtUniqueId = "${mktplcRef.publisher}.${mktplcRef.name}";
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ lib, stdenv, runCommand, buildEnv, vscode, makeWrapper
|
||||
{ lib, stdenv, runCommand, buildEnv, vscode, makeWrapper, writeText
|
||||
, vscodeExtensions ? [] }:
|
||||
|
||||
/*
|
||||
@ -46,12 +46,47 @@ let
|
||||
wrappedPkgVersion = lib.getVersion vscode;
|
||||
wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
|
||||
|
||||
combinedExtensionsDrv = buildEnv {
|
||||
name = "vscode-extensions";
|
||||
paths = vscodeExtensions;
|
||||
toExtensionJsonEntry = drv: rec {
|
||||
identifier = {
|
||||
id = "${drv.vscodeExtPublisher}.${drv.vscodeExtName}";
|
||||
uuid = "";
|
||||
};
|
||||
|
||||
version = drv.version;
|
||||
|
||||
location = {
|
||||
"$mid" = 1;
|
||||
fsPath = drv.outPath + "/share/vscode/extensions/${drv.vscodeExtUniqueId}";
|
||||
path = location.fsPath;
|
||||
scheme = "file";
|
||||
};
|
||||
|
||||
metadata = {
|
||||
id = identifier.uuid;
|
||||
publisherId = "";
|
||||
publisherDisplayName = drv.vscodeExtPublisher;
|
||||
targetPlatform = "undefined";
|
||||
isApplicationScoped = false;
|
||||
updated = false;
|
||||
isPreReleaseVersion = false;
|
||||
installedTimestamp = 0;
|
||||
preRelease = false;
|
||||
};
|
||||
};
|
||||
|
||||
extensionsFlag = lib.optionalString (vscodeExtensions != []) ''
|
||||
extensionJson = builtins.toJSON (map toExtensionJsonEntry vscodeExtensions);
|
||||
extensionJsonFile = writeText "extensions.json" extensionJson;
|
||||
extensionJsonOutput = runCommand "vscode-extensions-json" {} ''
|
||||
mkdir -p $out/share/vscode/extensions
|
||||
cp ${extensionJsonFile} $out/share/vscode/extensions/extensions.json
|
||||
'';
|
||||
|
||||
combinedExtensionsDrv = buildEnv {
|
||||
name = "vscode-extensions";
|
||||
paths = vscodeExtensions ++ [ extensionJsonOutput ];
|
||||
};
|
||||
|
||||
extensionsFlag = ''
|
||||
--add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions"
|
||||
'';
|
||||
in
|
||||
|
Loading…
Reference in New Issue
Block a user