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 vscode-extension-update-script,
12}:
13
14vscode-utils.buildVscodeMarketplaceExtension rec {
15 mktplcRef = {
16 name = "python";
17 publisher = "ms-python";
18 version = "2025.10.1";
19 hash = "sha256-3hd940mfxnvqoblIrx/S0A8KwHtYLFuonu52/HGGfak=";
20 };
21
22 buildInputs = [ icu ];
23
24 nativeBuildInputs = [ python3.pkgs.wrapPython ];
25
26 propagatedBuildInputs = with python3.pkgs; [
27 debugpy
28 jedi-language-server
29 ];
30
31 postPatch = ''
32 # remove bundled python deps and use libs from nixpkgs
33 rm -r python_files/lib
34 mkdir -p python_files/lib/python/
35 ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy python_files/lib/python/
36 buildPythonPath "$propagatedBuildInputs"
37 for i in python_files/*.py; do
38 patchPythonScript "$i"
39 done
40 ''
41 + lib.optionalString pythonUseFixed ''
42 # Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`.
43 substituteInPlace "./package.json" \
44 --replace-fail "\"default\":\"python\"" "\"default\":\"${python3.interpreter}\""
45 '';
46
47 passthru.updateScript = vscode-extension-update-script { };
48
49 meta = {
50 description = "Visual Studio Code extension with rich support for the Python language";
51 downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-python.python";
52 homepage = "https://github.com/Microsoft/vscode-python";
53 changelog = "https://github.com/microsoft/vscode-python/releases";
54 license = lib.licenses.mit;
55 platforms = [
56 "aarch64-linux"
57 "x86_64-linux"
58 "aarch64-darwin"
59 "x86_64-darwin"
60 ];
61 maintainers = [
62 lib.maintainers.jraygauthier
63 lib.maintainers.jfchevrette
64 ];
65 };
66}