Added Python language support

This commit is contained in:
Jan-Bulthuis 2024-12-02 00:52:55 +01:00
parent 34bba528b3
commit 3374b35053
1 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,56 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.python;
package = pkgs.python3.withPackages cfg.extraPythonPackages;
in
{
options.modules.python = {
enable = mkEnableOption "python";
extraPythonPackages = mkOption {
type = types.functionTo (types.listOf types.package) // {
merge =
loc: defs: p:
lib.concatMap (def: (def.value p)) defs;
};
default = p: [ ];
description = "Extra Python packages to install";
};
};
config = mkIf cfg.enable {
# Development packages
home.packages = [
package
];
# Allow unfree
modules.unfree.allowedPackages = [
"vscode-extension-MS-python-vscode-pylance"
];
# VSCode configuration
programs.vscode = {
extensions = with pkgs.vscode-extensions; [
ms-python.python
ms-python.debugpy
ms-python.vscode-pylance
];
userSettings = {
"[python]" = {
"editor.defaultFormatter" = "ms-python.vscode-pylance";
};
};
};
# Neovim configuration
programs.nixvim = { };
};
}