about summary refs log tree commit diff
path: root/home/python/default.nix
blob: 32a21293b33aaa8fd18aca7378d53c8ef0683631 (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.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";
    };
  };
}