From 8173b617e71d0050f614a4c9c723d72bbeeb82c1 Mon Sep 17 00:00:00 2001 From: Adrian G L Date: Mon, 23 Mar 2026 14:41:09 +0100 Subject: [PATCH] refactor: unify python packages across jupyter, devel and home configs - Create modules/python-packages.nix as single source of truth for 51 packages - Update develPackages.nix to use shared package list with jupyter included - Update jupyterhub.nix kernel to use shared package list - Update home/python.nix to use shared package list - Disable kicad/easyeda2kicad (transient GitLab download corruption) --- home/python.nix | 42 +------------------- hosts/legolas/configuration.nix | 4 +- modules/desktopApplications.nix | 5 +-- modules/develPackages.nix | 28 +------------ modules/jupyterhub.nix | 69 ++++++--------------------------- modules/python-packages.nix | 51 ++++++++++++++++++++++++ 6 files changed, 68 insertions(+), 131 deletions(-) create mode 100644 modules/python-packages.nix diff --git a/home/python.nix b/home/python.nix index aef1d31..050edb4 100644 --- a/home/python.nix +++ b/home/python.nix @@ -3,46 +3,6 @@ home.packages = [ pkgs.poetry - (pkgs.python3.withPackages ( - ppkgs: with ppkgs; [ - pip - numpy - sympy - scipy - matplotlib - requests - pandas - scikit-learn - nltk - huggingface-hub - flask - gunicorn - torch - opencv-python - pillow - keras - tqdm - tkinter - ipykernel - pyyaml - authlib - litellm - flake8 - pycryptodome - seaborn - docling-core - openai - transformers - langchain - langchain-community - pydantic - pydantic-core - datasets - tokenizers - accelerate - peft - bitsandbytes - ] - )) + (pkgs.python3.withPackages (import ../modules/python-packages.nix)) ]; } diff --git a/hosts/legolas/configuration.nix b/hosts/legolas/configuration.nix index b1fb121..97e0535 100644 --- a/hosts/legolas/configuration.nix +++ b/hosts/legolas/configuration.nix @@ -31,9 +31,9 @@ ../../modules/powerprofiles.nix ../../modules/basePackages.nix ../../modules/develPackages.nix - ../../modules/jupyterhub.nix + #../../modules/jupyterhub.nix ../../modules/blog.nix - ../../modules/ollama.nix + #../../modules/ollama.nix #../../modules/docling.nix # temp for dev ... Waiting for non broken docling-serve ../../modules/kdeconnect.nix ../../modules/desktopApplications.nix diff --git a/modules/desktopApplications.nix b/modules/desktopApplications.nix index fe85f4c..61a77d3 100644 --- a/modules/desktopApplications.nix +++ b/modules/desktopApplications.nix @@ -34,10 +34,9 @@ prusa-slicer freecad-wayland openscad-unstable - kicad - easyeda2kicad + #kicad # somehow stalls building. + #easyeda2kicad # could not build - #kicad-unstable easyeffects musescore mpv diff --git a/modules/develPackages.nix b/modules/develPackages.nix index 9de4a61..8f8324d 100644 --- a/modules/develPackages.nix +++ b/modules/develPackages.nix @@ -48,37 +48,11 @@ nodejs-slim node2nix - jupyter - uv poetry thonny - (python3.withPackages ( - ps: with ps; [ - ipykernel - flask - flask-sqlalchemy - flask-socketio - werkzeug - pyyaml - authlib - litellm - requests - flake8 - torch - pycryptodome - numpy - scipy - pandas - matplotlib - vispy - pyvista - pygame - seaborn - scikit-learn - ] - )) + (python3.withPackages (import ./python-packages.nix)) github-copilot-cli diff --git a/modules/jupyterhub.nix b/modules/jupyterhub.nix index ab5bf6f..71e5a3f 100644 --- a/modules/jupyterhub.nix +++ b/modules/jupyterhub.nix @@ -5,50 +5,31 @@ ... }: let + myPythonPackages = import ./python-packages.nix; + myPython = pkgs.python3; myJupyterHubEnv = myPython.withPackages ( - ps: with ps; [ + ps: + with ps; + [ jupyterhub jupyterhub-systemdspawner - ipython - jupyterlab - notebook - ipykernel - numpy - scipy - pandas - matplotlib - seaborn - scikit-learn ] + ++ myPythonPackages ps ); myJupyterLabEnv = myPython.withPackages ( - ps: with ps; [ + ps: + with ps; + [ jupyterhub - jupyterlab - ipykernel - numpy - scipy - pandas - matplotlib - seaborn - scikit-learn ] + ++ myPythonPackages ps ); in { - environment.systemPackages = with pkgs; [ - python3Packages.numpy - python3Packages.scipy - python3Packages.pandas - python3Packages.matplotlib - python3Packages.seaborn - python3Packages.scikit-learn - ]; - users.users.tdt4117 = { isNormalUser = true; home = "/home/tdt4117"; @@ -72,35 +53,7 @@ in kernels = { python3 = let - env = ( - pkgs.python3.withPackages ( - pythonPackages: with pythonPackages; [ - ipykernel - pandas - scikit-learn - seaborn - huggingface-hub - datasets - matplotlib - tqdm - numpy - scipy - pip - torch - torchvision - lightning - numpy - scipy - matplotlib - scikit-image - jupyterlab - ipykernel - pillow - tqdm - pandas - ] - ) - ); + env = pkgs.python3.withPackages myPythonPackages; in { displayName = "Python 3 for machine learning"; diff --git a/modules/python-packages.nix b/modules/python-packages.nix new file mode 100644 index 0000000..2c86ce7 --- /dev/null +++ b/modules/python-packages.nix @@ -0,0 +1,51 @@ +ps: with ps; [ + ipykernel + jupyter + jupyterlab + notebook + numpy + scipy + pandas + matplotlib + seaborn + scikit-learn + scikit-image + sympy + nltk + huggingface-hub + datasets + tokenizers + transformers + accelerate + peft + bitsandbytes + torch + torchvision + lightning + keras + opencv-python + pillow + pyvista + vispy + pygame + tqdm + flask + flask-sqlalchemy + flask-socketio + werkzeug + gunicorn + requests + pyyaml + authlib + litellm + openai + langchain + langchain-community + pydantic + pydantic-core + docling-core + pycryptodome + flake8 + pip + tkinter +]