{ config, pkgs, lib, ... }: let cfg = config.my.home.python; pythonEnv = pkgs.python3.withPackages (p: with p; [ black # format isort # format pylsp-mypy # language server protocol requests # HTTP library types-requests # types for requests (for mypy) pip # to install dependencies ipython # nicer REPL ]); in { options.my.home.python = with lib; { enable = mkEnableOption "python configuration"; }; config = lib.mkIf cfg.enable { home.packages = with pkgs.python3Packages; [ pythonEnv ]; home.sessionVariables = with config.xdg; { IPYTHONDIR = "${cacheHome}/ipython"; PIP_LOG = "${cacheHome}/pip/pip.log"; PYLINTHOME = "${cacheHome}/pylint"; PYTHON_EGG_CACHE = "${cacheHome}/python-eggs"; }; }; }