grimm-nixos-laptop/common/tooling/python.nix

60 lines
1.2 KiB
Nix

{
pkgs,
config,
lib,
...
}:
let
lang_support_id = "python";
inherit (config.grimmShared) enable tooling graphical;
pyLibs =
python-pkgs: with python-pkgs; [
requests
matplotlib
numpy
scipy
pygobject3
];
inherit (lib)
mkIf
types
mkOption
mapAttrsToList
concatLines
elem
;
in
{
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
environment.systemPackages = [
(pkgs.python3.withPackages pyLibs)
] ++ lib.optionals graphical (with pkgs; [ jetbrains.pycharm-community ]);
programs.xonsh = {
enable = true;
config = concatLines (
mapAttrsToList (
name: value: "aliases[\"${name}\"] = '''${value}'''"
) config.environment.shellAliases
);
# package = pkgs.xonsh.wrapper.override { extraPackages = pyLibs; };
};
grimmShared.tooling.lang_servers = [
{
lsp.package = pkgs.pyright;
fmt = {
package = pkgs.yapf;
includes = [ "*.py" ];
options = [ "-i" ];
};
}
];
};
options.grimmShared.tooling.supportedLangs = mkOption {
type = types.listOf (types.enum [ lang_support_id ]);
};
}