diff options
Diffstat (limited to 'pkgs/misc/vscode-extensions/python/default.nix')
-rw-r--r-- | pkgs/misc/vscode-extensions/python/default.nix | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/misc/vscode-extensions/python/default.nix b/pkgs/misc/vscode-extensions/python/default.nix new file mode 100644 index 000000000000..4e28de871b84 --- /dev/null +++ b/pkgs/misc/vscode-extensions/python/default.nix @@ -0,0 +1,41 @@ +{ stdenv, lib, vscode-utils + +, pythonUseFixed ? false, python # 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. +, ctagsUseFixed ? true, ctags # When `true`, the ctags default setting will be fixed to specified. + # Use version from `PATH` for default setting otherwise. + # Defaults to `true` as usually not defined on a per projet basis. +}: + +assert pythonUseFixed -> null != python; +assert ctagsUseFixed -> null != ctags; + +let + pythonDefaultsTo = if pythonUseFixed then "${python}/bin/python" else "python"; + ctagsDefaultsTo = if ctagsUseFixed then "${ctags}/bin/ctags" else "ctags"; +in + +vscode-utils.buildVscodeMarketplaceExtension { + mktplcRef = { + name = "python"; + publisher = "ms-python"; + version = "0.8.0"; + sha256 = "0i7s93l5g5lyi6vn77zh3ipj0p267y17fayv6vjrxc2igrs27ik6"; + }; + + postPatch = '' + # Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`. + substituteInPlace "./package.json" \ + --replace "\"default\": \"python\"" "\"default\": \"${pythonDefaultsTo}\"" + + # Patch `packages.json` so that nix's *ctags* is used as default value for `python.workspaceSymbols.ctagsPath`. + substituteInPlace "./package.json" \ + --replace "\"default\": \"ctags\"" "\"default\": \"${ctagsDefaultsTo}\"" + ''; + + meta = with lib; { + license = licenses.mit; + maintainer = [ maintainers.jraygauthier ]; + }; +} \ No newline at end of file |