aboutsummaryrefslogblamecommitdiff
path: root/home/python/default.nix
blob: fea30545e558ce5d641be762481e800a03bac159 (plain) (tree)
1
2
3
4
5
6
7
8
9
                           


                                                       


                                         
                           
                                                  


                                    
     

  
                                      


                                                   









                                                               
 
{ config, pkgs, lib, ... }:
let
  cfg = config.my.home.python;
  pythonEnv = pkgs.python310.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
    poetry # to install dependencies
  ]);
in
{
  options.my.home.python = with lib; {
    enable = mkEnableOption "python configuration";
  };

  config = lib.mkIf cfg.enable {
    home.packages = with pkgs.python310Packages; [ pythonEnv ];

    home.sessionVariables = with config.xdg; {
      PIP_LOG = "${cacheHome}/pip/pip.log";
      PYLINTHOME = "${cacheHome}/pylint";
      PYTHON_EGG_CACHE = "${cacheHome}/python-eggs";
      PYTHON_HISTFILE = "${cacheHome}/python_history";
    };
  };
}