about summary refs log tree commit diff
path: root/home/python/default.nix
blob: eb03803da0ae6615e7707b6998284d7f1cd703a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ 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
    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";
    };
  };
}