Modularize dev/python.nix

This commit is contained in:
Henrik Lissner 2020-04-06 23:04:29 -04:00
parent 1eeb7af2bb
commit 953c4c450b
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 37 additions and 27 deletions

View file

@ -11,7 +11,7 @@
# ./latex.nix # ./latex.nix
# ./love2d.nix # ./love2d.nix
# ./node.nix # ./node.nix
# ./python.nix ./python.nix
./rust.nix ./rust.nix
./scala.nix ./scala.nix
# ./unity3d.nix # ./unity3d.nix

View file

@ -4,35 +4,45 @@
# me. The Py2->3 transition make trainwrecks jealous. But SciPy, NumPy, iPython # me. The Py2->3 transition make trainwrecks jealous. But SciPy, NumPy, iPython
# and Jupyter can have my babies. Every single one. # and Jupyter can have my babies. Every single one.
{ lib, pkgs, ... }: { config, options, lib, pkgs, ... }:
with lib;
{ {
my = { options.modules.dev.python = {
packages = with pkgs; [ enable = mkOption {
python37 type = types.bool;
python37Packages.pip default = false;
python37Packages.ipython };
python37Packages.black };
python37Packages.setuptools
python37Packages.pylint
python37Packages.poetry
];
env.IPYTHONDIR = "$XDG_CONFIG_HOME/ipython"; config = mkIf config.modules.dev.python.enable {
env.PIP_CONFIG_FILE = "$XDG_CONFIG_HOME/pip/pip.conf"; my = {
env.PIP_LOG_FILE = "$XDG_DATA_HOME/pip/log"; packages = with pkgs; [
env.PYLINTHOME = "$XDG_DATA_HOME/pylint"; python37
env.PYLINTRC = "$XDG_CONFIG_HOME/pylint/pylintrc"; python37Packages.pip
env.PYTHONSTARTUP = "$XDG_CONFIG_HOME/python/pythonrc"; python37Packages.ipython
env.PYTHON_EGG_CACHE = "$XDG_CACHE_HOME/python-eggs"; python37Packages.black
env.JUPYTER_CONFIG_DIR = "$XDG_CONFIG_HOME/jupyter"; python37Packages.setuptools
python37Packages.pylint
python37Packages.poetry
];
zsh.rc = lib.readFile <config/python/aliases.zsh>; 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";
alias.py = "python"; zsh.rc = lib.readFile <config/python/aliases.zsh>;
alias.py2 = "python2";
alias.py3 = "python3"; alias.py = "python";
alias.po = "poetry"; alias.py2 = "python2";
alias.ipy = "ipython --no-banner"; alias.py3 = "python3";
alias.ipylab = "ipython --pylab=qt5 --no-banner"; alias.po = "poetry";
alias.ipy = "ipython --no-banner";
alias.ipylab = "ipython --pylab=qt5 --no-banner";
};
}; };
} }