1
1
mirror of https://github.com/divnix/digga.git synced 2024-12-26 09:34:15 +03:00
digga/profiles/develop/python/default.nix

43 lines
993 B
Nix
Raw Normal View History

2020-01-31 19:49:47 +03:00
{ pkgs, ... }:
let inherit (pkgs) python3Packages;
in {
environment.systemPackages = let
packages = pythonPackages:
with pythonPackages; [
numpy
pandas
ptpython
requests
scipy
];
python = pkgs.python3.withPackages packages;
in [ python ];
environment.sessionVariables = {
PYTHONSTARTUP = let
startup = pkgs.writers.writePython3 "ptpython.py" {
libraries = with python3Packages; [ ptpython ];
2020-01-31 19:49:47 +03:00
} ''
from __future__ import unicode_literals
from pygments.token import Token
from ptpython.layout import CompletionVisualisation
2020-01-31 19:49:47 +03:00
import sys
${builtins.readFile ./ptconfig.py}
2020-01-31 19:49:47 +03:00
try:
from ptpython.repl import embed
except ImportError:
print("ptpython is not available: falling back to standard prompt")
else:
sys.exit(embed(globals(), locals(), configure=configure))
2020-01-31 19:49:47 +03:00
'';
in "${startup}";
};
}