Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

87 lines
2.5 KiB
Nix

{
stdenv,
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,
# For updateScript
vscode-extension-update-script,
}:
let
supported = {
x86_64-linux = {
hash = "sha256-AlqZTioxiL0XPRMpWMWw8fIWoDAmU1ybCaDhlaXv6lc=";
arch = "linux-x64";
};
x86_64-darwin = {
hash = "sha256-IWj79vUJJXt88kDiCIHVY95aKsHB84vH3iv6GgLOFQo=";
arch = "darwin-x64";
};
aarch64-linux = {
hash = "sha256-kTSHvqS50UZ/yTMqJITyFIUZgHn1dMSwX1R3oxmTnYk=";
arch = "linux-arm64";
};
aarch64-darwin = {
hash = "sha256-LWA8LqCQrmd83icDYCmUgytPJbCV3ecNobSpWV2R3MA=";
arch = "darwin-arm64";
};
};
base =
supported.${stdenv.hostPlatform.system}
or (throw "unsupported platform ${stdenv.hostPlatform.system}");
in
vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = base // {
name = "python";
publisher = "ms-python";
version = "2025.12.0";
};
buildInputs = [ icu ];
nativeBuildInputs = [ python3.pkgs.wrapPython ];
propagatedBuildInputs = with python3.pkgs; [
debugpy
jedi-language-server
];
postPatch = ''
# remove bundled python deps and use libs from nixpkgs
rm -r python_files/lib
mkdir -p python_files/lib/python/
ln -s ${python3.pkgs.debugpy}/lib/*/site-packages/debugpy python_files/lib/python/
buildPythonPath "$propagatedBuildInputs"
for i in python_files/*.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-fail "\"default\":\"python\"" "\"default\":\"${python3.interpreter}\""
'';
passthru.updateScript = vscode-extension-update-script { };
meta = {
description = "Visual Studio Code extension with rich support for the Python language";
downloadPage = "https://marketplace.visualstudio.com/items?itemName=ms-python.python";
homepage = "https://github.com/Microsoft/vscode-python";
changelog = "https://github.com/microsoft/vscode-python/releases";
license = lib.licenses.mit;
platforms = builtins.attrNames supported;
maintainers = [
lib.maintainers.jraygauthier
lib.maintainers.jfchevrette
];
};
}