vscode-extensions.*: format with nixfmt (RFC 166)

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