10 vscodeExtensions ? [ ],
15 : A set of vscode extensions to be installed alongside the editor. Here's a an
19 vscode-with-extensions.override {
21 # When the extension is already available in the default extensions set.
22 vscodeExtensions = with vscode-extensions; [
26 # Concise version from the vscode market place when not available in the default set.
27 ++ vscode-utils.extensionsFromVscodeMarketplace [
30 publisher = "formulahendry";
32 sha256 = "166ia73vrcl5c9hm4q1a73qdn56m0jc7flfsk5p5q41na9f10lb0";
38 This expression should fetch
39 - the *nix* vscode extension from whatever source defined in the
40 default nixpkgs extensions set `vscodeExtensions`.
42 - the *code-runner* vscode extension from the marketplace using the
46 https://bbenoist.gallery.vsassets.io/_apis/public/gallery/publisher/bbenoist/extension/nix/1.0.1/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage
49 The original `code` executable will be wrapped so that it uses the set of pre-installed / unpacked
50 extensions as its `--extensions-dir`.
54 inherit (vscode) executableName longName;
55 wrappedPkgVersion = lib.getVersion vscode;
56 wrappedPkgName = lib.removeSuffix "-${wrappedPkgVersion}" vscode.name;
58 extensionJsonFile = writeTextFile {
59 name = "vscode-extensions-json";
60 destination = "/share/vscode/extensions/extensions.json";
61 text = vscode-utils.toExtensionJson vscodeExtensions;
64 combinedExtensionsDrv = buildEnv {
65 name = "vscode-extensions";
66 paths = vscodeExtensions ++ [ extensionJsonFile ];
70 --add-flags "--extensions-dir ${combinedExtensionsDrv}/share/vscode/extensions"
74 runCommand "${wrappedPkgName}-with-extensions-${wrappedPkgVersion}"
76 nativeBuildInputs = [ makeWrapper ];
77 buildInputs = [ vscode ];
83 if stdenv.hostPlatform.isDarwin then
86 mkdir -p "$out/Applications/${longName}.app/Contents/MacOS"
88 for path in PkgInfo Frameworks Resources _CodeSignature Info.plist; do
89 ln -s "${vscode}/Applications/${longName}.app/Contents/$path" "$out/Applications/${longName}.app/Contents/"
92 makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}
93 makeWrapper "${vscode}/Applications/${longName}.app/Contents/MacOS/Electron" "$out/Applications/${longName}.app/Contents/MacOS/Electron" ${extensionsFlag}
98 mkdir -p "$out/share/applications"
99 mkdir -p "$out/share/pixmaps"
101 ln -sT "${vscode}/share/pixmaps/vs${executableName}.png" "$out/share/pixmaps/vs${executableName}.png"
102 ln -sT "${vscode}/share/applications/${executableName}.desktop" "$out/share/applications/${executableName}.desktop"
103 ln -sT "${vscode}/share/applications/${executableName}-url-handler.desktop" "$out/share/applications/${executableName}-url-handler.desktop"
104 makeWrapper "${vscode}/bin/${executableName}" "$out/bin/${executableName}" ${extensionsFlag}