From 4c79faac59cfc1018b2a0a63264d04d913878507 Mon Sep 17 00:00:00 2001 From: Timothy DeHerrera Date: Fri, 31 Jan 2020 09:49:47 -0700 Subject: [PATCH] develop#python: init profile --- profiles/develop/kakoune/default.nix | 3 ++- profiles/develop/python/default.nix | 33 ++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 profiles/develop/python/default.nix diff --git a/profiles/develop/kakoune/default.nix b/profiles/develop/kakoune/default.nix index e27ba3f..a6350e4 100644 --- a/profiles/develop/kakoune/default.nix +++ b/profiles/develop/kakoune/default.nix @@ -1,4 +1,6 @@ { pkgs, ... }: { + imports = [ ../python ]; + environment.systemPackages = with pkgs; [ cquery kak-lsp @@ -6,7 +8,6 @@ kakoune-unwrapped nixfmt python3Packages.python-language-server - python3 rustup ]; diff --git a/profiles/develop/python/default.nix b/profiles/develop/python/default.nix new file mode 100644 index 0000000..2cd21f5 --- /dev/null +++ b/profiles/develop/python/default.nix @@ -0,0 +1,33 @@ +{ 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 = [ python3Packages.ptpython ]; + } '' + import sys + try: + from ptpython.repl import embed + except ImportError: + print("ptpython is not available: falling back to standard prompt") + else: + sys.exit(embed(globals(), locals())) + ''; + in "${startup}"; + }; +} +