vscode-extensions.*: format with nixfmt (RFC 166)
This commit is contained in:
parent
c10b1bb002
commit
7bf9febfa6
27 changed files with 735 additions and 496 deletions
|
@ -1,22 +1,21 @@
|
|||
{ lib
|
||||
, vscode-utils }:
|
||||
{ lib, vscode-utils }:
|
||||
|
||||
let
|
||||
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||
in
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-wakatime";
|
||||
publisher = "WakaTime";
|
||||
version = "18.0.5";
|
||||
hash = "sha256-vWqGxMbxKqd4UgKK0sOKadMTDf6Y3TQxfWsc93MHjFs=";
|
||||
};
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-wakatime";
|
||||
publisher = "WakaTime";
|
||||
version = "18.0.5";
|
||||
hash = "sha256-vWqGxMbxKqd4UgKK0sOKadMTDf6Y3TQxfWsc93MHjFs=";
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = ''
|
||||
Visual Studio Code plugin for automatic time tracking and metrics generated
|
||||
from your programming activity
|
||||
'';
|
||||
license = lib.licenses.bsd3;
|
||||
};
|
||||
}
|
||||
meta = {
|
||||
description = ''
|
||||
Visual Studio Code plugin for automatic time tracking and metrics generated
|
||||
from your programming activity
|
||||
'';
|
||||
license = lib.licenses.bsd3;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
{ lib, stdenv, vscode-utils, callPackage }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
vscode-utils,
|
||||
callPackage,
|
||||
}:
|
||||
let
|
||||
version = "1.50.0";
|
||||
rescript-editor-analysis = callPackage ./rescript-editor-analysis.nix { inherit version; };
|
||||
arch =
|
||||
if stdenv.isLinux then "linux"
|
||||
else if stdenv.isDarwin then "darwin"
|
||||
else throw "Unsupported system: ${stdenv.system}";
|
||||
if stdenv.isLinux then
|
||||
"linux"
|
||||
else if stdenv.isDarwin then
|
||||
"darwin"
|
||||
else
|
||||
throw "Unsupported system: ${stdenv.system}";
|
||||
analysisDir = "server/analysis_binaries/${arch}";
|
||||
in
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
|
@ -23,7 +31,10 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
|||
meta = {
|
||||
description = "The official VSCode plugin for ReScript";
|
||||
homepage = "https://github.com/rescript-lang/rescript-vscode";
|
||||
maintainers = [ lib.maintainers.dlip lib.maintainers.jayesh-bhoot ];
|
||||
maintainers = [
|
||||
lib.maintainers.dlip
|
||||
lib.maintainers.jayesh-bhoot
|
||||
];
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
{ lib, stdenv, fetchFromGitHub, bash, ocaml, ocamlPackages, dune_3, version }:
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
bash,
|
||||
ocaml,
|
||||
ocamlPackages,
|
||||
dune_3,
|
||||
version,
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "rescript-editor-analysis";
|
||||
|
@ -11,7 +20,11 @@ stdenv.mkDerivation {
|
|||
hash = "sha256-+Ht8qWwxtFWHFMiV/aoZIs2S3SxkOWgdwSKN+akp/LU=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ ocaml dune_3 ocamlPackages.cppo ];
|
||||
nativeBuildInputs = [
|
||||
ocaml
|
||||
dune_3
|
||||
ocamlPackages.cppo
|
||||
];
|
||||
|
||||
# Skip testing phases because they need to download and install node modules
|
||||
postPatch = ''
|
||||
|
@ -28,7 +41,10 @@ stdenv.mkDerivation {
|
|||
meta = {
|
||||
description = "Analysis binary for the ReScript VSCode plugin";
|
||||
homepage = "https://github.com/rescript-lang/rescript-vscode";
|
||||
maintainers = [ lib.maintainers.dlip lib.maintainers.jayesh-bhoot ];
|
||||
maintainers = [
|
||||
lib.maintainers.dlip
|
||||
lib.maintainers.jayesh-bhoot
|
||||
];
|
||||
license = lib.licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
{ graphviz
|
||||
, jre
|
||||
, lib
|
||||
, makeWrapper
|
||||
, vscode-utils
|
||||
{
|
||||
graphviz,
|
||||
jre,
|
||||
lib,
|
||||
makeWrapper,
|
||||
vscode-utils,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
|
@ -13,13 +14,9 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
|||
hash = "sha256-TvApcBBI+Egu7t4tJuEYTs6mhvABOY2eXVb57O4gWfs=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
];
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
buildInputs = [
|
||||
graphviz
|
||||
];
|
||||
buildInputs = [ graphviz ];
|
||||
|
||||
postInstall = ''
|
||||
wrapProgram $out/share/vscode/extensions/contextmapper.context-mapper-vscode-extension/lsp/bin/context-mapper-lsp \
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ lib
|
||||
, vscode-utils
|
||||
}:
|
||||
{ lib, vscode-utils }:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{ lib, vscode-utils, terraform-ls }:
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
terraform-ls,
|
||||
}:
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
mktplcRef = {
|
||||
name = "terraform";
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
{ lib, vscode-utils, plantuml, jq, moreutils }:
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
plantuml,
|
||||
jq,
|
||||
moreutils,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
@ -7,7 +13,10 @@ vscode-utils.buildVscodeMarketplaceExtension {
|
|||
version = "2.17.4";
|
||||
hash = "sha256-fnz6ubB73i7rJcv+paYyNV1r4cReuyFPjgPM0HO40ug=";
|
||||
};
|
||||
nativeBuildInputs = [ jq moreutils ];
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
moreutils
|
||||
];
|
||||
postInstall = ''
|
||||
cd "$out/$installPrefix"
|
||||
jq '.contributes.configuration.properties."plantuml.java".default = "${plantuml}/bin/plantuml"' package.json | sponge package.json
|
||||
|
@ -15,13 +24,10 @@ vscode-utils.buildVscodeMarketplaceExtension {
|
|||
|
||||
meta = {
|
||||
description = "A Visual Studio Code extension for supporting Rich PlantUML";
|
||||
downloadPage =
|
||||
"https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml";
|
||||
downloadPage = "https://marketplace.visualstudio.com/items?itemName=jebbs.plantuml";
|
||||
homepage = "https://github.com/qjebbs/vscode-plantuml";
|
||||
changelog =
|
||||
"https://marketplace.visualstudio.com/items/jebbs.plantuml/changelog";
|
||||
changelog = "https://marketplace.visualstudio.com/items/jebbs.plantuml/changelog";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = [ lib.maintainers.victormignot ];
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,12 @@ with vscode-utils;
|
|||
|
||||
let
|
||||
|
||||
buildVscodeLanguagePack = { language, version ? "1.76.2023030809", sha256 }:
|
||||
buildVscodeLanguagePack =
|
||||
{
|
||||
language,
|
||||
version ? "1.76.2023030809",
|
||||
sha256,
|
||||
}:
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "vscode-language-pack-${language}";
|
||||
|
@ -15,7 +20,6 @@ let
|
|||
license = lib.licenses.mit;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# See list of core language packs at https://github.com/Microsoft/vscode-loc
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
{ publisher, name, version, arch ? "", sha256 ? "", hash ? "" }:
|
||||
{
|
||||
publisher,
|
||||
name,
|
||||
version,
|
||||
arch ? "",
|
||||
sha256 ? "",
|
||||
hash ? "",
|
||||
}:
|
||||
let
|
||||
archurl = (if arch == "" then "" else "?targetPlatform=${arch}");
|
||||
in
|
||||
|
|
|
@ -1,56 +1,59 @@
|
|||
{ lib
|
||||
, icu
|
||||
, openssl
|
||||
, patchelf
|
||||
, stdenv
|
||||
, vscode-utils
|
||||
{
|
||||
lib,
|
||||
icu,
|
||||
openssl,
|
||||
patchelf,
|
||||
stdenv,
|
||||
vscode-utils,
|
||||
}:
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
inherit (vscode-utils) buildVscodeMarketplaceExtension;
|
||||
|
||||
extInfo = {
|
||||
x86_64-linux = {
|
||||
arch = "linux-x64";
|
||||
hash = "sha256-7m85Zl9oV40le3nkNPzoKu/AAf8XhQpI8sBMsQXmBg8=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/servicehub-controller-net60.linux-x64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-code-servicehost.linux-x64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-reliability-monitor.linux-x64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-server.linux-x64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
aarch64-linux = {
|
||||
arch = "linux-arm64";
|
||||
hash = "sha256-39D55EdwE4baDYbHc9GD/1XoxGbQkUkS1H2uysJHlxw=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/servicehub-controller-net60.linux-arm64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-code-servicehost.linux-arm64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-reliability-monitor.linux-arm64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-server.linux-arm64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-x64";
|
||||
hash = "sha256-gfhJX07R+DIw9FbzaEE0JZwEmDeifiq4vHyMHZZ1udM=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/servicehub-controller-net60.darwin-x64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-code-servicehost.darwin-x64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-reliability-monitor.darwin-x64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-server.darwin-x64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
aarch64-darwin = {
|
||||
arch = "darwin-arm64";
|
||||
hash = "sha256-vogstgCWvI9csNF9JfJ41XPR1POy842g2yhWqIDoHLw=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/servicehub-controller-net60.darwin-arm64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-code-servicehost.darwin-arm64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-reliability-monitor.darwin-arm64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-server.darwin-arm64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
}.${system} or (throw "Unsupported system: ${system}");
|
||||
extInfo =
|
||||
{
|
||||
x86_64-linux = {
|
||||
arch = "linux-x64";
|
||||
hash = "sha256-7m85Zl9oV40le3nkNPzoKu/AAf8XhQpI8sBMsQXmBg8=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/servicehub-controller-net60.linux-x64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-code-servicehost.linux-x64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-reliability-monitor.linux-x64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/linux-x64/node_modules/@microsoft/visualstudio-server.linux-x64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
aarch64-linux = {
|
||||
arch = "linux-arm64";
|
||||
hash = "sha256-39D55EdwE4baDYbHc9GD/1XoxGbQkUkS1H2uysJHlxw=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/servicehub-controller-net60.linux-arm64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-code-servicehost.linux-arm64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-reliability-monitor.linux-arm64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/linux-arm64/node_modules/@microsoft/visualstudio-server.linux-arm64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-x64";
|
||||
hash = "sha256-gfhJX07R+DIw9FbzaEE0JZwEmDeifiq4vHyMHZZ1udM=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/servicehub-controller-net60.darwin-x64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-code-servicehost.darwin-x64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-reliability-monitor.darwin-x64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/darwin-x64/node_modules/@microsoft/visualstudio-server.darwin-x64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
aarch64-darwin = {
|
||||
arch = "darwin-arm64";
|
||||
hash = "sha256-vogstgCWvI9csNF9JfJ41XPR1POy842g2yhWqIDoHLw=";
|
||||
binaries = [
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/servicehub-controller-net60.darwin-arm64/Microsoft.ServiceHub.Controller"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-code-servicehost.darwin-arm64/Microsoft.VisualStudio.Code.ServiceHost"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-reliability-monitor.darwin-arm64/Microsoft.VisualStudio.Reliability.Monitor"
|
||||
"components/vs-green-server/platforms/darwin-arm64/node_modules/@microsoft/visualstudio-server.darwin-arm64/Microsoft.VisualStudio.Code.Server"
|
||||
];
|
||||
};
|
||||
}
|
||||
.${system} or (throw "Unsupported system: ${system}");
|
||||
in
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
@ -61,50 +64,55 @@ buildVscodeMarketplaceExtension {
|
|||
};
|
||||
sourceRoot = "extension"; # This has more than one folder.
|
||||
|
||||
nativeBuildInputs = [
|
||||
patchelf
|
||||
];
|
||||
nativeBuildInputs = [ patchelf ];
|
||||
|
||||
postPatch = ''
|
||||
declare ext_unique_id
|
||||
ext_unique_id="$(basename "$out" | head -c 32)"
|
||||
postPatch =
|
||||
''
|
||||
declare ext_unique_id
|
||||
ext_unique_id="$(basename "$out" | head -c 32)"
|
||||
|
||||
patchelf_add_icu_as_needed() {
|
||||
declare elf="''${1?}"
|
||||
declare icu_major_v="${
|
||||
lib.head (lib.splitVersion (lib.getVersion icu.name))
|
||||
}"
|
||||
patchelf_add_icu_as_needed() {
|
||||
declare elf="''${1?}"
|
||||
declare icu_major_v="${lib.head (lib.splitVersion (lib.getVersion icu.name))}"
|
||||
|
||||
for icu_lib in icui18n icuuc icudata; do
|
||||
patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf"
|
||||
done
|
||||
}
|
||||
for icu_lib in icui18n icuuc icudata; do
|
||||
patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf"
|
||||
done
|
||||
}
|
||||
|
||||
patchelf_common() {
|
||||
declare elf="''${1?}"
|
||||
patchelf_common() {
|
||||
declare elf="''${1?}"
|
||||
|
||||
patchelf_add_icu_as_needed "$elf"
|
||||
patchelf --add-needed "libssl.so" "$elf"
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${lib.makeLibraryPath [stdenv.cc.cc openssl icu.out]}:\$ORIGIN" \
|
||||
"$elf"
|
||||
}
|
||||
patchelf_add_icu_as_needed "$elf"
|
||||
patchelf --add-needed "libssl.so" "$elf"
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${
|
||||
lib.makeLibraryPath [
|
||||
stdenv.cc.cc
|
||||
openssl
|
||||
icu.out
|
||||
]
|
||||
}:\$ORIGIN" \
|
||||
"$elf"
|
||||
}
|
||||
|
||||
substituteInPlace dist/extension.js \
|
||||
--replace 'e.extensionPath,"cache"' 'require("os").tmpdir(),"'"$ext_unique_id"'"' \
|
||||
--replace 't.setExecuteBit=async function(e){if("win32"!==process.platform){const t=i.join(e[a.SERVICEHUB_CONTROLLER_COMPONENT_NAME],"Microsoft.ServiceHub.Controller"),n=i.join(e[a.SERVICEHUB_HOST_COMPONENT_NAME],(0,a.getServiceHubHostEntrypointName)()),r=[(0,a.getServerPath)(e),t,n,(0,c.getReliabilityMonitorPath)(e)];await Promise.all(r.map((e=>(0,o.chmod)(e,"0755"))))}}' 't.setExecuteBit=async function(e){}'
|
||||
substituteInPlace dist/extension.js \
|
||||
--replace 'e.extensionPath,"cache"' 'require("os").tmpdir(),"'"$ext_unique_id"'"' \
|
||||
--replace 't.setExecuteBit=async function(e){if("win32"!==process.platform){const t=i.join(e[a.SERVICEHUB_CONTROLLER_COMPONENT_NAME],"Microsoft.ServiceHub.Controller"),n=i.join(e[a.SERVICEHUB_HOST_COMPONENT_NAME],(0,a.getServiceHubHostEntrypointName)()),r=[(0,a.getServerPath)(e),t,n,(0,c.getReliabilityMonitorPath)(e)];await Promise.all(r.map((e=>(0,o.chmod)(e,"0755"))))}}' 't.setExecuteBit=async function(e){}'
|
||||
|
||||
''
|
||||
+ (lib.concatStringsSep "\n" (map
|
||||
(bin: ''
|
||||
chmod +x "${bin}"
|
||||
'')
|
||||
extInfo.binaries))
|
||||
+ lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map
|
||||
(bin: ''
|
||||
patchelf_common "${bin}"
|
||||
'')
|
||||
extInfo.binaries));
|
||||
''
|
||||
+ (lib.concatStringsSep "\n" (
|
||||
map (bin: ''
|
||||
chmod +x "${bin}"
|
||||
'') extInfo.binaries
|
||||
))
|
||||
+ lib.optionalString stdenv.isLinux (
|
||||
lib.concatStringsSep "\n" (
|
||||
map (bin: ''
|
||||
patchelf_common "${bin}"
|
||||
'') extInfo.binaries
|
||||
)
|
||||
);
|
||||
|
||||
meta = {
|
||||
changelog = "https://marketplace.visualstudio.com/items/ms-dotnettools.csdevkit/changelog";
|
||||
|
@ -112,6 +120,11 @@ buildVscodeMarketplaceExtension {
|
|||
downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = [ lib.maintainers.ggg ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{ lib
|
||||
, vscode-utils
|
||||
, patchelf
|
||||
, icu
|
||||
, stdenv
|
||||
, openssl
|
||||
, coreutils
|
||||
,
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
patchelf,
|
||||
icu,
|
||||
stdenv,
|
||||
openssl,
|
||||
coreutils,
|
||||
}:
|
||||
let
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
|
@ -26,31 +26,32 @@ let
|
|||
".debugger/x86_64/vsdbg"
|
||||
];
|
||||
in
|
||||
{
|
||||
x86_64-linux = {
|
||||
arch = "linux-x64";
|
||||
hash = "sha256-si4HKGVIHu44QNlNI2WEnMff9+QZOMWiBfWQaaFGyQE=";
|
||||
binaries = linuxBins;
|
||||
};
|
||||
aarch64-linux = {
|
||||
arch = "linux-arm64";
|
||||
hash = "sha256-1IXkSRgCHOLD4VeCdqyy54MXCBUX5RDDb3pf7GQH5jA=";
|
||||
binaries = linuxBins;
|
||||
};
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-x64";
|
||||
hash = "sha256-AAbYjZ+YYyGEXSLkiFfluLf7P4OzPhmHzK44N5XT9UI=";
|
||||
binaries = darwinBins;
|
||||
};
|
||||
aarch64-darwin = {
|
||||
arch = "darwin-arm64";
|
||||
hash = "sha256-1m47kX0Jo+UvthNfgdoPdBBOcDyCA8DfP+zRk3SicR0=";
|
||||
binaries = darwinBins ++ [
|
||||
".debugger/arm64/vsdbg-ui"
|
||||
".debugger/arm64/vsdbg"
|
||||
];
|
||||
};
|
||||
}.${system} or (throw "Unsupported system: ${system}");
|
||||
{
|
||||
x86_64-linux = {
|
||||
arch = "linux-x64";
|
||||
hash = "sha256-si4HKGVIHu44QNlNI2WEnMff9+QZOMWiBfWQaaFGyQE=";
|
||||
binaries = linuxBins;
|
||||
};
|
||||
aarch64-linux = {
|
||||
arch = "linux-arm64";
|
||||
hash = "sha256-1IXkSRgCHOLD4VeCdqyy54MXCBUX5RDDb3pf7GQH5jA=";
|
||||
binaries = linuxBins;
|
||||
};
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-x64";
|
||||
hash = "sha256-AAbYjZ+YYyGEXSLkiFfluLf7P4OzPhmHzK44N5XT9UI=";
|
||||
binaries = darwinBins;
|
||||
};
|
||||
aarch64-darwin = {
|
||||
arch = "darwin-arm64";
|
||||
hash = "sha256-1m47kX0Jo+UvthNfgdoPdBBOcDyCA8DfP+zRk3SicR0=";
|
||||
binaries = darwinBins ++ [
|
||||
".debugger/arm64/vsdbg-ui"
|
||||
".debugger/arm64/vsdbg"
|
||||
];
|
||||
};
|
||||
}
|
||||
.${system} or (throw "Unsupported system: ${system}");
|
||||
in
|
||||
buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
@ -60,16 +61,13 @@ buildVscodeMarketplaceExtension {
|
|||
inherit (extInfo) hash arch;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
patchelf
|
||||
];
|
||||
nativeBuildInputs = [ patchelf ];
|
||||
|
||||
postPatch = ''
|
||||
postPatch =
|
||||
''
|
||||
patchelf_add_icu_as_needed() {
|
||||
declare elf="''${1?}"
|
||||
declare icu_major_v="${
|
||||
lib.head (lib.splitVersion (lib.getVersion icu.name))
|
||||
}"
|
||||
declare icu_major_v="${lib.head (lib.splitVersion (lib.getVersion icu.name))}"
|
||||
|
||||
for icu_lib in icui18n icuuc icudata; do
|
||||
patchelf --add-needed "lib''${icu_lib}.so.$icu_major_v" "$elf"
|
||||
|
@ -82,7 +80,13 @@ buildVscodeMarketplaceExtension {
|
|||
patchelf_add_icu_as_needed "$elf"
|
||||
patchelf --add-needed "libssl.so" "$elf"
|
||||
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
|
||||
--set-rpath "${lib.makeLibraryPath [stdenv.cc.cc openssl icu.out]}:\$ORIGIN" \
|
||||
--set-rpath "${
|
||||
lib.makeLibraryPath [
|
||||
stdenv.cc.cc
|
||||
openssl
|
||||
icu.out
|
||||
]
|
||||
}:\$ORIGIN" \
|
||||
"$elf"
|
||||
}
|
||||
|
||||
|
@ -90,22 +94,29 @@ buildVscodeMarketplaceExtension {
|
|||
--replace 'uname -m' '${lib.getExe' coreutils "uname"} -m'
|
||||
|
||||
''
|
||||
+ (lib.concatStringsSep "\n" (map
|
||||
(bin: ''
|
||||
+ (lib.concatStringsSep "\n" (
|
||||
map (bin: ''
|
||||
chmod +x "${bin}"
|
||||
'')
|
||||
extInfo.binaries))
|
||||
+ lib.optionalString stdenv.isLinux (lib.concatStringsSep "\n" (map
|
||||
(bin: ''
|
||||
patchelf_common "${bin}"
|
||||
'')
|
||||
extInfo.binaries));
|
||||
'') extInfo.binaries
|
||||
))
|
||||
+ lib.optionalString stdenv.isLinux (
|
||||
lib.concatStringsSep "\n" (
|
||||
map (bin: ''
|
||||
patchelf_common "${bin}"
|
||||
'') extInfo.binaries
|
||||
)
|
||||
);
|
||||
|
||||
meta = {
|
||||
description = "Official C# support for Visual Studio Code";
|
||||
homepage = "https://github.com/dotnet/vscode-csharp";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ ggg ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
"x86_64-darwin"
|
||||
"aarch64-darwin"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
{ lib
|
||||
, vscode-utils
|
||||
, icu
|
||||
, python3
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
icu,
|
||||
python3,
|
||||
# When `true`, the python default setting will be fixed to specified.
|
||||
# Use version from `PATH` for default setting otherwise.
|
||||
# Defaults to `false` as we expect it to be project specific most of the time.
|
||||
, pythonUseFixed ? false
|
||||
pythonUseFixed ? false,
|
||||
# For updateScript
|
||||
, writeScript
|
||||
, bash
|
||||
, curl
|
||||
, coreutils
|
||||
, gnused
|
||||
, jq
|
||||
, nix
|
||||
writeScript,
|
||||
bash,
|
||||
curl,
|
||||
coreutils,
|
||||
gnused,
|
||||
jq,
|
||||
nix,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension rec {
|
||||
|
@ -33,33 +34,37 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
|||
jedi-language-server
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# remove bundled python deps and use libs from nixpkgs
|
||||
rm -r pythonFiles/lib
|
||||
mkdir -p pythonFiles/lib/python/
|
||||
ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy pythonFiles/lib/python/
|
||||
buildPythonPath "$propagatedBuildInputs"
|
||||
for i in pythonFiles/*.py; do
|
||||
patchPythonScript "$i"
|
||||
done
|
||||
'' + lib.optionalString pythonUseFixed ''
|
||||
# Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`.
|
||||
substituteInPlace "./package.json" \
|
||||
--replace "\"default\": \"python\"" "\"default\": \"${python3.interpreter}\""
|
||||
'';
|
||||
postPatch =
|
||||
''
|
||||
# remove bundled python deps and use libs from nixpkgs
|
||||
rm -r pythonFiles/lib
|
||||
mkdir -p pythonFiles/lib/python/
|
||||
ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy pythonFiles/lib/python/
|
||||
buildPythonPath "$propagatedBuildInputs"
|
||||
for i in pythonFiles/*.py; do
|
||||
patchPythonScript "$i"
|
||||
done
|
||||
''
|
||||
+ lib.optionalString pythonUseFixed ''
|
||||
# Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`.
|
||||
substituteInPlace "./package.json" \
|
||||
--replace "\"default\": \"python\"" "\"default\": \"${python3.interpreter}\""
|
||||
'';
|
||||
|
||||
passthru.updateScript = writeScript "update" ''
|
||||
#! ${bash}/bin/bash
|
||||
|
||||
set -eu -o pipefail
|
||||
|
||||
export PATH=${lib.makeBinPath [
|
||||
curl
|
||||
coreutils
|
||||
gnused
|
||||
jq
|
||||
nix
|
||||
]}
|
||||
export PATH=${
|
||||
lib.makeBinPath [
|
||||
curl
|
||||
coreutils
|
||||
gnused
|
||||
jq
|
||||
nix
|
||||
]
|
||||
}
|
||||
|
||||
api=$(curl -s 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery' \
|
||||
-H 'accept: application/json;api-version=3.0-preview.1' \
|
||||
|
@ -82,7 +87,14 @@ vscode-utils.buildVscodeMarketplaceExtension rec {
|
|||
homepage = "https://github.com/Microsoft/vscode-python";
|
||||
changelog = "https://github.com/microsoft/vscode-python/releases";
|
||||
license = lib.licenses.mit;
|
||||
platforms = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
|
||||
maintainers = [ lib.maintainers.jraygauthier lib.maintainers.jfchevrette ];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
maintainers = [
|
||||
lib.maintainers.jraygauthier
|
||||
lib.maintainers.jfchevrette
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{ lib, vscode-utils, jq, moreutils }:
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
jq,
|
||||
moreutils,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
{ lib
|
||||
, nixosTests
|
||||
, vscode-utils
|
||||
, useLocalExtensions ? false
|
||||
{
|
||||
lib,
|
||||
nixosTests,
|
||||
vscode-utils,
|
||||
useLocalExtensions ? false,
|
||||
}:
|
||||
# Note that useLocalExtensions requires that vscode-server is not running
|
||||
# on host. If it is, you'll need to remove $HOME/.vscode-server,
|
||||
|
@ -92,7 +93,9 @@ buildVscodeMarketplaceExtension {
|
|||
--replace '# Start the server\n' '${patch}'
|
||||
'';
|
||||
|
||||
passthru.tests = { inherit (nixosTests) vscode-remote-ssh; };
|
||||
passthru.tests = {
|
||||
inherit (nixosTests) vscode-remote-ssh;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Use any remote machine with a SSH server as your development environment.";
|
||||
|
|
|
@ -1,8 +1,19 @@
|
|||
{ lib, vscode-utils
|
||||
, fetchurl, writeScript, runtimeShell
|
||||
, jq, clang-tools
|
||||
, gdbUseFixed ? true, gdb # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise.
|
||||
, autoPatchelfHook, makeWrapper, stdenv, lttng-ust, libkrb5, zlib
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
fetchurl,
|
||||
writeScript,
|
||||
runtimeShell,
|
||||
jq,
|
||||
clang-tools,
|
||||
gdbUseFixed ? true,
|
||||
gdb, # The gdb default setting will be fixed to specified. Use version from `PATH` otherwise.
|
||||
autoPatchelfHook,
|
||||
makeWrapper,
|
||||
stdenv,
|
||||
lttng-ust,
|
||||
libkrb5,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
/*
|
||||
|
@ -94,7 +105,13 @@ vscode-utils.buildVscodeMarketplaceExtension {
|
|||
description = "The C/C++ extension adds language support for C/C++ to Visual Studio Code, including features such as IntelliSense and debugging.";
|
||||
homepage = "https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools";
|
||||
license = lib.licenses.unfree;
|
||||
maintainers = [ lib.maintainers.jraygauthier lib.maintainers.stargate01 ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
maintainers = [
|
||||
lib.maintainers.jraygauthier
|
||||
lib.maintainers.stargate01
|
||||
];
|
||||
platforms = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
{ lib, vscode-utils, xsel }:
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
xsel,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, vscode-utils
|
||||
, jq
|
||||
, rust-analyzer
|
||||
, nodePackages
|
||||
, moreutils
|
||||
, esbuild
|
||||
, pkg-config
|
||||
, libsecret
|
||||
, stdenv
|
||||
, darwin
|
||||
, setDefaultServerPath ? true
|
||||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
vscode-utils,
|
||||
jq,
|
||||
rust-analyzer,
|
||||
nodePackages,
|
||||
moreutils,
|
||||
esbuild,
|
||||
pkg-config,
|
||||
libsecret,
|
||||
stdenv,
|
||||
darwin,
|
||||
setDefaultServerPath ? true,
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -29,26 +30,32 @@ let
|
|||
hash = "sha256-Oj/RPMridKpYt3eRqUIPg9YNrj6npG8THIGuWjsamnE=";
|
||||
};
|
||||
|
||||
build-deps = nodePackages."rust-analyzer-build-deps-../../applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps";
|
||||
build-deps =
|
||||
nodePackages."rust-analyzer-build-deps-../../applications/editors/vscode/extensions/rust-lang.rust-analyzer/build-deps";
|
||||
# FIXME: Making a new derivation to link `node_modules` and run `npm run package`
|
||||
# will cause a build failure.
|
||||
vsix = build-deps.override {
|
||||
src = "${src}/editors/code";
|
||||
outputs = [ "vsix" "out" ];
|
||||
outputs = [
|
||||
"vsix"
|
||||
"out"
|
||||
];
|
||||
|
||||
inherit releaseTag;
|
||||
|
||||
nativeBuildInputs = [
|
||||
jq
|
||||
moreutils
|
||||
esbuild
|
||||
# Required by `keytar`, which is a dependency of `vsce`.
|
||||
pkg-config
|
||||
libsecret
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
nativeBuildInputs =
|
||||
[
|
||||
jq
|
||||
moreutils
|
||||
esbuild
|
||||
# Required by `keytar`, which is a dependency of `vsce`.
|
||||
pkg-config
|
||||
libsecret
|
||||
]
|
||||
++ lib.optionals stdenv.isDarwin [
|
||||
darwin.apple_sdk.frameworks.AppKit
|
||||
darwin.apple_sdk.frameworks.Security
|
||||
];
|
||||
|
||||
# Follows https://github.com/rust-lang/rust-analyzer/blob/41949748a6123fd6061eb984a47f4fe780525e63/xtask/src/dist.rs#L39-L65
|
||||
postRebuild = ''
|
||||
|
@ -65,7 +72,6 @@ let
|
|||
echo y | npx vsce package -o $vsix/${pname}.zip
|
||||
'';
|
||||
};
|
||||
|
||||
in
|
||||
vscode-utils.buildVscodeExtension {
|
||||
inherit version vsix;
|
||||
|
@ -75,7 +81,10 @@ vscode-utils.buildVscodeExtension {
|
|||
vscodeExtPublisher = publisher;
|
||||
vscodeExtName = pname;
|
||||
|
||||
nativeBuildInputs = lib.optionals setDefaultServerPath [ jq moreutils ];
|
||||
nativeBuildInputs = lib.optionals setDefaultServerPath [
|
||||
jq
|
||||
moreutils
|
||||
];
|
||||
|
||||
preInstall = lib.optionalString setDefaultServerPath ''
|
||||
jq '.contributes.configuration.properties."rust-analyzer.server.path".default = $s' \
|
||||
|
@ -86,9 +95,11 @@ vscode-utils.buildVscodeExtension {
|
|||
meta = {
|
||||
description = "An alternative rust language server to the RLS";
|
||||
homepage = "https://github.com/rust-lang/rust-analyzer";
|
||||
license = [ lib.licenses.mit lib.licenses.asl20 ];
|
||||
license = [
|
||||
lib.licenses.mit
|
||||
lib.licenses.asl20
|
||||
];
|
||||
maintainers = [ ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ lib
|
||||
, vscode-utils
|
||||
, lua-language-server
|
||||
{
|
||||
lib,
|
||||
vscode-utils,
|
||||
lua-language-server,
|
||||
}:
|
||||
|
||||
vscode-utils.buildVscodeMarketplaceExtension {
|
||||
|
|
|
@ -1,39 +1,43 @@
|
|||
# Updates the vscode setting file base on a nix expression
|
||||
# should run from the workspace root.
|
||||
{ writeShellScriptBin
|
||||
, lib
|
||||
, jq
|
||||
{
|
||||
writeShellScriptBin,
|
||||
lib,
|
||||
jq,
|
||||
}:
|
||||
##User Input
|
||||
{ settings ? {}
|
||||
# if marked as true will create an empty json file if does not exist
|
||||
, createIfDoesNotExists ? true
|
||||
, vscodeSettingsFile ? ".vscode/settings.json"
|
||||
, userSettingsFolder ? ""
|
||||
, symlinkFromUserSetting ? false
|
||||
{
|
||||
settings ? { },
|
||||
# if marked as true will create an empty json file if does not exist
|
||||
createIfDoesNotExists ? true,
|
||||
vscodeSettingsFile ? ".vscode/settings.json",
|
||||
userSettingsFolder ? "",
|
||||
symlinkFromUserSetting ? false,
|
||||
}:
|
||||
let
|
||||
|
||||
updateVSCodeSettingsCmd = ''
|
||||
(
|
||||
echo 'updateSettings.nix: Updating ${vscodeSettingsFile}...'
|
||||
oldSettings=$(cat ${vscodeSettingsFile})
|
||||
echo $oldSettings' ${builtins.toJSON settings}' | ${jq}/bin/jq -s add > ${vscodeSettingsFile}
|
||||
)'';
|
||||
(
|
||||
echo 'updateSettings.nix: Updating ${vscodeSettingsFile}...'
|
||||
oldSettings=$(cat ${vscodeSettingsFile})
|
||||
echo $oldSettings' ${builtins.toJSON settings}' | ${jq}/bin/jq -s add > ${vscodeSettingsFile}
|
||||
)'';
|
||||
|
||||
createEmptySettingsCmd = ''mkdir -p .vscode && echo "{}" > ${vscodeSettingsFile}'';
|
||||
fileName = builtins.baseNameOf vscodeSettingsFile;
|
||||
symlinkFromUserSettingCmd = lib.optionalString symlinkFromUserSetting
|
||||
'' && mkdir -p "${userSettingsFolder}" && ln -sfv "$(pwd)/${vscodeSettingsFile}" "${userSettingsFolder}/" '';
|
||||
symlinkFromUserSettingCmd = lib.optionalString symlinkFromUserSetting ''&& mkdir -p "${userSettingsFolder}" && ln -sfv "$(pwd)/${vscodeSettingsFile}" "${userSettingsFolder}/" '';
|
||||
in
|
||||
|
||||
writeShellScriptBin ''vscodeNixUpdate-${lib.removeSuffix ".json" (fileName)}''
|
||||
(lib.optionalString (settings != {})
|
||||
(if createIfDoesNotExists then ''
|
||||
[ ! -f "${vscodeSettingsFile}" ] && ${createEmptySettingsCmd}
|
||||
${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd}
|
||||
''
|
||||
else ''[ -f "${vscodeSettingsFile}" ] && ${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd}
|
||||
''
|
||||
)
|
||||
writeShellScriptBin ''vscodeNixUpdate-${lib.removeSuffix ".json" (fileName)}'' (
|
||||
lib.optionalString (settings != { }) (
|
||||
if createIfDoesNotExists then
|
||||
''
|
||||
[ ! -f "${vscodeSettingsFile}" ] && ${createEmptySettingsCmd}
|
||||
${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd}
|
||||
''
|
||||
else
|
||||
''
|
||||
[ -f "${vscodeSettingsFile}" ] && ${updateVSCodeSettingsCmd} ${symlinkFromUserSettingCmd}
|
||||
''
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
with import <nixpkgs>{};
|
||||
callPackage (import ./updateSettings.nix) {} {
|
||||
with import <nixpkgs> { };
|
||||
callPackage (import ./updateSettings.nix) { } {
|
||||
settings = {
|
||||
a = "fdsdf";
|
||||
};
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
{ pkgs, lib, stdenv, fetchFromGitHub, runCommand, rustPlatform, makeWrapper, llvmPackages
|
||||
, buildNpmPackage, cmake, nodejs, unzip, python3, pkg-config, libsecret, darwin
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
runCommand,
|
||||
rustPlatform,
|
||||
makeWrapper,
|
||||
llvmPackages,
|
||||
buildNpmPackage,
|
||||
cmake,
|
||||
nodejs,
|
||||
unzip,
|
||||
python3,
|
||||
pkg-config,
|
||||
libsecret,
|
||||
darwin,
|
||||
}:
|
||||
assert lib.versionAtLeast python3.version "3.5";
|
||||
let
|
||||
|
@ -31,9 +46,7 @@ let
|
|||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
env = lib.optionalAttrs stdenv.isDarwin {
|
||||
NIX_LDFLAGS = "-llldb -lc++abi";
|
||||
};
|
||||
env = lib.optionalAttrs stdenv.isDarwin { NIX_LDFLAGS = "-llldb -lc++abi"; };
|
||||
|
||||
buildAndTestSubdir = "adapter";
|
||||
|
||||
|
@ -76,12 +89,15 @@ let
|
|||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libsecret
|
||||
] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
|
||||
Security
|
||||
AppKit
|
||||
]);
|
||||
buildInputs =
|
||||
[ libsecret ]
|
||||
++ lib.optionals stdenv.isDarwin (
|
||||
with darwin.apple_sdk.frameworks;
|
||||
[
|
||||
Security
|
||||
AppKit
|
||||
]
|
||||
);
|
||||
|
||||
dontNpmBuild = true;
|
||||
|
||||
|
@ -103,14 +119,25 @@ let
|
|||
"/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver"
|
||||
else
|
||||
"${lldb.out}/bin/lldb-server";
|
||||
|
||||
in stdenv.mkDerivation {
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "vscode-extension-${publisher}-${pname}";
|
||||
inherit src version vscodeExtUniqueId vscodeExtPublisher vscodeExtName;
|
||||
inherit
|
||||
src
|
||||
version
|
||||
vscodeExtUniqueId
|
||||
vscodeExtPublisher
|
||||
vscodeExtName
|
||||
;
|
||||
|
||||
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||
|
||||
nativeBuildInputs = [ cmake nodejs unzip makeWrapper ];
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
nodejs
|
||||
unzip
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
patches = [ ./cmake-build-extension-only.patch ];
|
||||
|
||||
|
@ -120,12 +147,14 @@ in stdenv.mkDerivation {
|
|||
--replace "1.9.2" ${version}
|
||||
'';
|
||||
|
||||
postConfigure = ''
|
||||
cp -r ${nodeDeps}/lib/node_modules .
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
export HOME="$TMPDIR/home"
|
||||
mkdir $HOME
|
||||
'';
|
||||
postConfigure =
|
||||
''
|
||||
cp -r ${nodeDeps}/lib/node_modules .
|
||||
''
|
||||
+ lib.optionalString stdenv.isDarwin ''
|
||||
export HOME="$TMPDIR/home"
|
||||
mkdir $HOME
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
# Do not append timestamp to version.
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
# Patched lldb for Rust language support.
|
||||
{ fetchFromGitHub, runCommand, llvmPackages }:
|
||||
{
|
||||
fetchFromGitHub,
|
||||
runCommand,
|
||||
llvmPackages,
|
||||
}:
|
||||
let
|
||||
llvmSrc = fetchFromGitHub {
|
||||
owner = "vadimcn";
|
||||
|
@ -8,8 +12,9 @@ let
|
|||
rev = "4c267c83cbb55fedf2e0b89644dc1db320fdfde7";
|
||||
hash = "sha256-jM//ej6AxnRYj+8BAn4QrxHPT6HiDzK5RqHPSg3dCcw=";
|
||||
};
|
||||
in (llvmPackages.lldb.overrideAttrs (oldAttrs: rec {
|
||||
passthru = (oldAttrs.passthru or {}) // {
|
||||
in
|
||||
(llvmPackages.lldb.overrideAttrs (oldAttrs: rec {
|
||||
passthru = (oldAttrs.passthru or { }) // {
|
||||
inherit llvmSrc;
|
||||
};
|
||||
|
||||
|
@ -23,7 +28,8 @@ in (llvmPackages.lldb.overrideAttrs (oldAttrs: rec {
|
|||
echo "'lldb --version' returns: $versionOutput"
|
||||
echo "$versionOutput" | grep -q 'rust-enabled'
|
||||
'';
|
||||
})).override({
|
||||
monorepoSrc = llvmSrc;
|
||||
libllvm = llvmPackages.libllvm.override({ monorepoSrc = llvmSrc; });
|
||||
})
|
||||
})).override
|
||||
({
|
||||
monorepoSrc = llvmSrc;
|
||||
libllvm = llvmPackages.libllvm.override ({ monorepoSrc = llvmSrc; });
|
||||
})
|
||||
|
|
|
@ -1,77 +1,101 @@
|
|||
{ stdenv, lib, buildEnv, writeShellScriptBin, fetchurl, vscode, unzip, jq }:
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
buildEnv,
|
||||
writeShellScriptBin,
|
||||
fetchurl,
|
||||
vscode,
|
||||
unzip,
|
||||
jq,
|
||||
}:
|
||||
let
|
||||
buildVscodeExtension = a@{
|
||||
name,
|
||||
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
|
||||
runHook postConfigure
|
||||
'',
|
||||
buildPhase ?''
|
||||
runHook preBuild
|
||||
runHook postBuild
|
||||
'',
|
||||
dontPatchELF ? true,
|
||||
dontStrip ? true,
|
||||
nativeBuildInputs ? [],
|
||||
passthru ? { },
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation ((removeAttrs a [ "vscodeExtUniqueId" ]) // {
|
||||
buildVscodeExtension =
|
||||
a@{
|
||||
name,
|
||||
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
|
||||
runHook postConfigure
|
||||
'',
|
||||
buildPhase ? ''
|
||||
runHook preBuild
|
||||
runHook postBuild
|
||||
'',
|
||||
dontPatchELF ? true,
|
||||
dontStrip ? true,
|
||||
nativeBuildInputs ? [ ],
|
||||
passthru ? { },
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation (
|
||||
(removeAttrs a [ "vscodeExtUniqueId" ])
|
||||
// {
|
||||
|
||||
name = "vscode-extension-${name}";
|
||||
name = "vscode-extension-${name}";
|
||||
|
||||
passthru = passthru // {
|
||||
inherit vscodeExtPublisher vscodeExtName vscodeExtUniqueId;
|
||||
};
|
||||
passthru = passthru // {
|
||||
inherit vscodeExtPublisher vscodeExtName vscodeExtUniqueId;
|
||||
};
|
||||
|
||||
inherit configurePhase buildPhase dontPatchELF dontStrip;
|
||||
inherit
|
||||
configurePhase
|
||||
buildPhase
|
||||
dontPatchELF
|
||||
dontStrip
|
||||
;
|
||||
|
||||
# Some .vsix files contain other directories (e.g., `package`) that we don't use.
|
||||
# If other directories are present but `sourceRoot` is unset, the unpacker phase fails.
|
||||
sourceRoot = "extension";
|
||||
# Some .vsix files contain other directories (e.g., `package`) that we don't use.
|
||||
# If other directories are present but `sourceRoot` is unset, the unpacker phase fails.
|
||||
sourceRoot = "extension";
|
||||
|
||||
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||
installPrefix = "share/vscode/extensions/${vscodeExtUniqueId}";
|
||||
|
||||
nativeBuildInputs = [ unzip ] ++ nativeBuildInputs;
|
||||
nativeBuildInputs = [ unzip ] ++ nativeBuildInputs;
|
||||
|
||||
installPhase = ''
|
||||
installPhase = ''
|
||||
|
||||
runHook preInstall
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p "$out/$installPrefix"
|
||||
find . -mindepth 1 -maxdepth 1 | xargs -d'\n' mv -t "$out/$installPrefix/"
|
||||
mkdir -p "$out/$installPrefix"
|
||||
find . -mindepth 1 -maxdepth 1 | xargs -d'\n' mv -t "$out/$installPrefix/"
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
fetchVsixFromVscodeMarketplace =
|
||||
mktplcExtRef: fetchurl (import ./mktplcExtRefToFetchArgs.nix mktplcExtRef);
|
||||
|
||||
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" ]) // {
|
||||
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}";
|
||||
});
|
||||
buildVscodeMarketplaceExtension =
|
||||
a@{
|
||||
name ? "",
|
||||
src ? null,
|
||||
vsix ? null,
|
||||
mktplcRef,
|
||||
...
|
||||
}:
|
||||
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}";
|
||||
}
|
||||
);
|
||||
|
||||
mktplcRefAttrList = [
|
||||
"name"
|
||||
|
@ -82,14 +106,18 @@ let
|
|||
"arch"
|
||||
];
|
||||
|
||||
mktplcExtRefToExtDrv = ext:
|
||||
buildVscodeMarketplaceExtension (removeAttrs ext mktplcRefAttrList // {
|
||||
mktplcRef = builtins.intersectAttrs (lib.genAttrs mktplcRefAttrList (_: null)) ext;
|
||||
});
|
||||
mktplcExtRefToExtDrv =
|
||||
ext:
|
||||
buildVscodeMarketplaceExtension (
|
||||
removeAttrs ext mktplcRefAttrList
|
||||
// {
|
||||
mktplcRef = builtins.intersectAttrs (lib.genAttrs mktplcRefAttrList (_: null)) ext;
|
||||
}
|
||||
);
|
||||
|
||||
extensionFromVscodeMarketplace = mktplcExtRefToExtDrv;
|
||||
extensionsFromVscodeMarketplace = mktplcExtRefList:
|
||||
builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
|
||||
extensionsFromVscodeMarketplace =
|
||||
mktplcExtRefList: builtins.map extensionFromVscodeMarketplace mktplcExtRefList;
|
||||
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
inherit lib extensionsFromVscodeMarketplace writeShellScriptBin;
|
||||
|
@ -102,7 +130,13 @@ let
|
|||
};
|
||||
|
||||
vscodeEnv = import ./vscodeEnv.nix {
|
||||
inherit lib buildEnv writeShellScriptBin extensionsFromVscodeMarketplace jq;
|
||||
inherit
|
||||
lib
|
||||
buildEnv
|
||||
writeShellScriptBin
|
||||
extensionsFromVscodeMarketplace
|
||||
jq
|
||||
;
|
||||
vscodeDefault = vscode;
|
||||
};
|
||||
|
||||
|
@ -139,9 +173,16 @@ let
|
|||
toExtensionJson = extensions: builtins.toJSON (map toExtensionJsonEntry extensions);
|
||||
in
|
||||
{
|
||||
inherit fetchVsixFromVscodeMarketplace buildVscodeExtension
|
||||
buildVscodeMarketplaceExtension extensionFromVscodeMarketplace
|
||||
extensionsFromVscodeMarketplace
|
||||
vscodeWithConfiguration vscodeExts2nix vscodeEnv
|
||||
toExtensionJsonEntry toExtensionJson;
|
||||
inherit
|
||||
fetchVsixFromVscodeMarketplace
|
||||
buildVscodeExtension
|
||||
buildVscodeMarketplaceExtension
|
||||
extensionFromVscodeMarketplace
|
||||
extensionsFromVscodeMarketplace
|
||||
vscodeWithConfiguration
|
||||
vscodeExts2nix
|
||||
vscodeEnv
|
||||
toExtensionJsonEntry
|
||||
toExtensionJson
|
||||
;
|
||||
}
|
||||
|
|
|
@ -1,47 +1,58 @@
|
|||
#Use vscodeWithConfiguration and vscodeExts2nix to create a vscode executable. When the executable exits, it updates the mutable extension file, which is imported when evaluated by Nix later.
|
||||
{ lib
|
||||
, buildEnv
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
, vscodeDefault
|
||||
, jq
|
||||
{
|
||||
lib,
|
||||
buildEnv,
|
||||
writeShellScriptBin,
|
||||
extensionsFromVscodeMarketplace,
|
||||
vscodeDefault,
|
||||
jq,
|
||||
}:
|
||||
##User input
|
||||
{ vscode ? vscodeDefault
|
||||
, nixExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
# will add to the command updateSettings (which will run on executing vscode) settings to override in settings.json file
|
||||
, settings ? {}
|
||||
, createSettingsIfDoesNotExists ? true
|
||||
, launch ? {}
|
||||
, createLaunchIfDoesNotExists ? true
|
||||
# will add to the command updateKeybindings(which will run on executing vscode) keybindings to override in keybinding.json file
|
||||
, keybindings ? {}
|
||||
, createKeybindingsIfDoesNotExists ? true
|
||||
, user-data-dir ? ''"''${TMP}''${name}"/vscode-data-dir''
|
||||
# if file exists will use it and import the extensions in it into this derivation else will use empty extensions list
|
||||
# this file will be created/updated by vscodeExts2nix when vscode exists
|
||||
, mutableExtensionsFile
|
||||
{
|
||||
vscode ? vscodeDefault,
|
||||
nixExtensions ? [ ],
|
||||
vscodeExtsFolderName ? ".vscode-exts",
|
||||
# will add to the command updateSettings (which will run on executing vscode) settings to override in settings.json file
|
||||
settings ? { },
|
||||
createSettingsIfDoesNotExists ? true,
|
||||
launch ? { },
|
||||
createLaunchIfDoesNotExists ? true,
|
||||
# will add to the command updateKeybindings(which will run on executing vscode) keybindings to override in keybinding.json file
|
||||
keybindings ? { },
|
||||
createKeybindingsIfDoesNotExists ? true,
|
||||
user-data-dir ? ''"''${TMP}''${name}"/vscode-data-dir'',
|
||||
# if file exists will use it and import the extensions in it into this derivation else will use empty extensions list
|
||||
# this file will be created/updated by vscodeExts2nix when vscode exists
|
||||
mutableExtensionsFile,
|
||||
}:
|
||||
let
|
||||
mutableExtensionsFilePath = toString mutableExtensionsFile;
|
||||
mutableExtensions = lib.optionals (builtins.pathExists mutableExtensionsFile) (import mutableExtensionsFilePath);
|
||||
vscodeWithConfiguration = import ./vscodeWithConfiguration.nix {
|
||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
}
|
||||
{
|
||||
inherit nixExtensions mutableExtensions vscodeExtsFolderName user-data-dir;
|
||||
};
|
||||
mutableExtensions = lib.optionals (builtins.pathExists mutableExtensionsFile) (
|
||||
import mutableExtensionsFilePath
|
||||
);
|
||||
vscodeWithConfiguration =
|
||||
import ./vscodeWithConfiguration.nix
|
||||
{
|
||||
inherit lib writeShellScriptBin extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
}
|
||||
{
|
||||
inherit
|
||||
nixExtensions
|
||||
mutableExtensions
|
||||
vscodeExtsFolderName
|
||||
user-data-dir
|
||||
;
|
||||
};
|
||||
|
||||
updateSettings = import ./updateSettings.nix { inherit lib writeShellScriptBin jq; };
|
||||
userSettingsFolder = "${ user-data-dir }/User";
|
||||
userSettingsFolder = "${user-data-dir}/User";
|
||||
|
||||
updateSettingsCmd = updateSettings {
|
||||
settings = {
|
||||
"extensions.autoCheckUpdates" = false;
|
||||
"extensions.autoUpdate" = false;
|
||||
"update.mode" = "none";
|
||||
"extensions.autoCheckUpdates" = false;
|
||||
"extensions.autoUpdate" = false;
|
||||
"update.mode" = "none";
|
||||
} // settings;
|
||||
inherit userSettingsFolder;
|
||||
createIfDoesNotExists = createSettingsIfDoesNotExists;
|
||||
|
@ -62,14 +73,16 @@ let
|
|||
symlinkFromUserSetting = (user-data-dir != "");
|
||||
};
|
||||
|
||||
vscodeExts2nix = import ./vscodeExts2nix.nix {
|
||||
inherit lib writeShellScriptBin;
|
||||
vscodeDefault = vscodeWithConfiguration;
|
||||
}
|
||||
{
|
||||
extensionsToIgnore = nixExtensions;
|
||||
extensions = mutableExtensions;
|
||||
};
|
||||
vscodeExts2nix =
|
||||
import ./vscodeExts2nix.nix
|
||||
{
|
||||
inherit lib writeShellScriptBin;
|
||||
vscodeDefault = vscodeWithConfiguration;
|
||||
}
|
||||
{
|
||||
extensionsToIgnore = nixExtensions;
|
||||
extensions = mutableExtensions;
|
||||
};
|
||||
code = writeShellScriptBin "code" ''
|
||||
${updateSettingsCmd}/bin/vscodeNixUpdate-settings
|
||||
${updateLaunchCmd}/bin/vscodeNixUpdate-launch
|
||||
|
@ -81,5 +94,11 @@ let
|
|||
in
|
||||
buildEnv {
|
||||
name = "vscodeEnv";
|
||||
paths = [ code vscodeExts2nix updateSettingsCmd updateLaunchCmd updateKeybindingsCmd ];
|
||||
paths = [
|
||||
code
|
||||
vscodeExts2nix
|
||||
updateSettingsCmd
|
||||
updateLaunchCmd
|
||||
updateKeybindingsCmd
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
with import <nixpkgs>{};
|
||||
callPackage (import ./vscodeEnv.nix) {
|
||||
extensionsFromVscodeMarketplace = vscode-utils.extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
} {
|
||||
mutableExtensionsFile = ./extensions.nix;
|
||||
settings = {
|
||||
a = "fdsdf";
|
||||
t = "test";
|
||||
};
|
||||
}
|
||||
with import <nixpkgs> { };
|
||||
callPackage (import ./vscodeEnv.nix)
|
||||
{
|
||||
extensionsFromVscodeMarketplace = vscode-utils.extensionsFromVscodeMarketplace;
|
||||
vscodeDefault = vscode;
|
||||
}
|
||||
{
|
||||
mutableExtensionsFile = ./extensions.nix;
|
||||
settings = {
|
||||
a = "fdsdf";
|
||||
t = "test";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
# based on the passed vscode will stdout a nix expression with the installed vscode extensions
|
||||
{ lib
|
||||
, vscodeDefault
|
||||
, writeShellScriptBin
|
||||
{
|
||||
lib,
|
||||
vscodeDefault,
|
||||
writeShellScriptBin,
|
||||
}:
|
||||
|
||||
##User input
|
||||
{ vscode ? vscodeDefault
|
||||
, extensionsToIgnore ? []
|
||||
# will use those extensions to get sha256 if still exists when executed.
|
||||
, extensions ? []
|
||||
{
|
||||
vscode ? vscodeDefault,
|
||||
extensionsToIgnore ? [ ],
|
||||
# will use those extensions to get sha256 if still exists when executed.
|
||||
extensions ? [ ],
|
||||
}:
|
||||
let
|
||||
mktplcExtRefToFetchArgs = import ./mktplcExtRefToFetchArgs.nix;
|
||||
|
@ -17,22 +19,32 @@ writeShellScriptBin "vscodeExts2nix" ''
|
|||
echo '['
|
||||
|
||||
for line in $(${vscode}/bin/code --list-extensions --show-versions \
|
||||
${lib.optionalString (extensionsToIgnore != []) ''
|
||||
| grep -v -i '^\(${lib.concatMapStringsSep "\\|" (e : "${e.publisher}.${e.name}") extensionsToIgnore}\)'
|
||||
''}
|
||||
${
|
||||
lib.optionalString (extensionsToIgnore != [ ]) ''
|
||||
| grep -v -i '^\(${
|
||||
lib.concatMapStringsSep "\\|" (e: "${e.publisher}.${e.name}") extensionsToIgnore
|
||||
}\)'
|
||||
''
|
||||
}
|
||||
) ; do
|
||||
[[ $line =~ ([^.]*)\.([^@]*)@(.*) ]]
|
||||
name=''${BASH_REMATCH[2]}
|
||||
publisher=''${BASH_REMATCH[1]}
|
||||
version=''${BASH_REMATCH[3]}
|
||||
|
||||
extensions="${lib.concatMapStringsSep "." (e : "${e.publisher}${e.name}@${e.sha256}") extensions}"
|
||||
extensions="${lib.concatMapStringsSep "." (e: "${e.publisher}${e.name}@${e.sha256}") extensions}"
|
||||
reCurrentExt=$publisher$name"@([^.]*)"
|
||||
if [[ $extensions =~ $reCurrentExt ]]; then
|
||||
sha256=''${BASH_REMATCH[1]}
|
||||
else
|
||||
sha256=$(
|
||||
nix-prefetch-url "${(mktplcExtRefToFetchArgs {publisher = ''"$publisher"''; name = ''"$name"''; version = ''"$version"'';}).url}" 2> /dev/null
|
||||
nix-prefetch-url "${
|
||||
(mktplcExtRefToFetchArgs {
|
||||
publisher = ''"$publisher"'';
|
||||
name = ''"$name"'';
|
||||
version = ''"$version"'';
|
||||
}).url
|
||||
}" 2> /dev/null
|
||||
)
|
||||
fi
|
||||
|
||||
|
|
|
@ -1,54 +1,61 @@
|
|||
# wrapper over vscode to control extensions per project (extensions folder will be created in execution path)
|
||||
{ lib
|
||||
, writeShellScriptBin
|
||||
, extensionsFromVscodeMarketplace
|
||||
, vscodeDefault
|
||||
{
|
||||
lib,
|
||||
writeShellScriptBin,
|
||||
extensionsFromVscodeMarketplace,
|
||||
vscodeDefault,
|
||||
}:
|
||||
## User input
|
||||
{ vscode ? vscodeDefault
|
||||
# extensions to be symlinked into the project's extensions folder
|
||||
, nixExtensions ? []
|
||||
# extensions to be copied into the project's extensions folder
|
||||
, mutableExtensions ? []
|
||||
, vscodeExtsFolderName ? ".vscode-exts"
|
||||
, user-data-dir ? ''"''${TMP}vscodeWithConfiguration/vscode-data-dir"''
|
||||
{
|
||||
vscode ? vscodeDefault,
|
||||
# extensions to be symlinked into the project's extensions folder
|
||||
nixExtensions ? [ ],
|
||||
# extensions to be copied into the project's extensions folder
|
||||
mutableExtensions ? [ ],
|
||||
vscodeExtsFolderName ? ".vscode-exts",
|
||||
user-data-dir ? ''"''${TMP}vscodeWithConfiguration/vscode-data-dir"'',
|
||||
}:
|
||||
let
|
||||
nixExtsDrvs = extensionsFromVscodeMarketplace nixExtensions;
|
||||
mutExtsDrvs = extensionsFromVscodeMarketplace mutableExtensions;
|
||||
mutableExtsPaths = lib.forEach mutExtsDrvs ( e:
|
||||
{
|
||||
mutableExtsPaths = lib.forEach mutExtsDrvs (e: {
|
||||
origin = "${e}/share/vscode/extensions/${e.vscodeExtUniqueId}";
|
||||
target = ''${vscodeExtsFolderName}/${e.vscodeExtUniqueId}-${(lib.findSingle (ext: "${ext.publisher}.${ext.name}" == e.vscodeExtUniqueId) "" "m" mutableExtensions ).version}'';
|
||||
}
|
||||
);
|
||||
target = ''${vscodeExtsFolderName}/${e.vscodeExtUniqueId}-${
|
||||
(lib.findSingle (
|
||||
ext: "${ext.publisher}.${ext.name}" == e.vscodeExtUniqueId
|
||||
) "" "m" mutableExtensions).version
|
||||
}'';
|
||||
});
|
||||
|
||||
#removed not defined extensions
|
||||
rmExtensions = lib.optionalString (nixExtensions++mutableExtensions != []) ''
|
||||
rmExtensions = lib.optionalString (nixExtensions ++ mutableExtensions != [ ]) ''
|
||||
find ${vscodeExtsFolderName} -mindepth 1 -maxdepth 1 ${
|
||||
lib.concatMapStringsSep " " (e : "! -iname ${e.publisher}.${e.name} ") nixExtensions
|
||||
+
|
||||
lib.concatMapStringsSep " " (e : "! -iname ${e.publisher}.${e.name}-${e.version} ") mutableExtensions
|
||||
} -exec rm -rf {} \;
|
||||
lib.concatMapStringsSep " " (e: "! -iname ${e.publisher}.${e.name} ") nixExtensions
|
||||
+ lib.concatMapStringsSep " " (
|
||||
e: "! -iname ${e.publisher}.${e.name}-${e.version} "
|
||||
) mutableExtensions
|
||||
} -exec rm -rf {} \;
|
||||
'';
|
||||
#copy mutable extension out of the nix store
|
||||
cpExtensions = ''
|
||||
${lib.concatMapStringsSep "\n" (e : "ln -sfn ${e}/share/vscode/extensions/* ${vscodeExtsFolderName}/") nixExtsDrvs}
|
||||
${lib.concatMapStringsSep "\n" (ePath : ''
|
||||
${lib.concatMapStringsSep "\n" (
|
||||
e: "ln -sfn ${e}/share/vscode/extensions/* ${vscodeExtsFolderName}/"
|
||||
) nixExtsDrvs}
|
||||
${lib.concatMapStringsSep "\n" (ePath: ''
|
||||
if [ ! -d ${ePath.target} ]; then
|
||||
cp -a ${ePath.origin} ${ePath.target}
|
||||
chmod -R u+rwx ${ePath.target}
|
||||
fi
|
||||
'') mutableExtsPaths}
|
||||
'') mutableExtsPaths}
|
||||
'';
|
||||
in
|
||||
writeShellScriptBin "code" ''
|
||||
if ! [[ "$@" =~ "--list-extension" ]]; then
|
||||
mkdir -p "${vscodeExtsFolderName}"
|
||||
${rmExtensions}
|
||||
${cpExtensions}
|
||||
fi
|
||||
${vscode}/bin/code --extensions-dir "${vscodeExtsFolderName}" ${
|
||||
lib.optionalString (user-data-dir != "") "--user-data-dir ${user-data-dir}"
|
||||
} "$@"
|
||||
''
|
||||
writeShellScriptBin "code" ''
|
||||
if ! [[ "$@" =~ "--list-extension" ]]; then
|
||||
mkdir -p "${vscodeExtsFolderName}"
|
||||
${rmExtensions}
|
||||
${cpExtensions}
|
||||
fi
|
||||
${vscode}/bin/code --extensions-dir "${vscodeExtsFolderName}" ${
|
||||
lib.optionalString (user-data-dir != "") "--user-data-dir ${user-data-dir}"
|
||||
} "$@"
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue