bonfire/modules/dev/python.nix
2023-06-07 01:28:05 +05:00

42 lines
1.3 KiB
Nix

{ config, options, lib, pkgs, ... }:
with lib;
with lib.custom;
let
devCfg = config.modules.dev;
cfg = devCfg.python;
in {
options.modules.dev.python = {
enable = mkBoolOpt false;
xdg.enable = mkBoolOpt devCfg.xdg.enable;
};
config = mkMerge [
(mkIf cfg.enable {
user.packages = with pkgs; [
python310
python310Packages.pip
python310Packages.ipython
python310Packages.black
python310Packages.setuptools
python310Packages.pylint
python310Packages.poetry-core
];
environment.shellAliases = {
py = "python";
};
})
(mkIf cfg.xdg.enable {
env.IPYTHONDIR = "$XDG_CONFIG_HOME/ipython";
env.PIP_CONFIG_FILE = "$XDG_CONFIG_HOME/pip/pip.conf";
env.PIP_LOG_FILE = "$XDG_DATA_HOME/pip/log";
env.PYLINTHOME = "$XDG_DATA_HOME/pylint";
env.PYLINTRC = "$XDG_CONFIG_HOME/pylint/pylintrc";
env.PYTHONSTARTUP = "$XDG_CONFIG_HOME/python/pythonrc";
env.PYTHON_EGG_CACHE = "$XDG_CACHE_HOME/python-eggs";
env.JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter";
})
];
}