From 71d533fcea9e3894b2014c76fd038311ba57c068 Mon Sep 17 00:00:00 2001 From: Daniel Winkler Date: Tue, 26 Aug 2025 11:30:17 +1000 Subject: [PATCH] no longer load most software by default and automatic marimo installation via uv --- .gitignore | 3 ++ templates/n/flake.lock | 35 +++++++++++++++++------ templates/n/flake.nix | 63 ++++++++++++++++++++++++++++++------------ 3 files changed, 74 insertions(+), 27 deletions(-) diff --git a/.gitignore b/.gitignore index 5bfb5c9..f7f46a8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .DS_Store .direnv +.python-version +pyproject.toml +uv.lock diff --git a/templates/n/flake.lock b/templates/n/flake.lock index 62ab0dc..25bd9f4 100644 --- a/templates/n/flake.lock +++ b/templates/n/flake.lock @@ -6,6 +6,7 @@ "nixpkgs": [ "nixpkgs" ], + "nixpkgs-unstable": "nixpkgs-unstable", "plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references", "plugins-cmp-r": "plugins-cmp-r", "plugins-r": "plugins-r", @@ -14,11 +15,11 @@ ] }, "locked": { - "lastModified": 1755872133, - "narHash": "sha256-E9GBi7PYnFSjMkovuEYK87hl8+POko9ZXMAY3hZFNBU=", + "lastModified": 1756169393, + "narHash": "sha256-088/iAKxFGxSCIP5TZvDVtljJIaNXVOp4AjL4iYxF88=", "owner": "dwinkler1", "repo": "nixCatsConfig", - "rev": "63953ae7d806b91e339a7da241751a033a6d9979", + "rev": "1f4d59fc8566681f5fa957dfd57ed1d1311b601a", "type": "github" }, "original": { @@ -29,11 +30,11 @@ }, "nixCats_2": { "locked": { - "lastModified": 1755685723, - "narHash": "sha256-WU7yfMmEbYmJnTWPe0RQpZyjf3c+btJ3BfE9RlnTtU0=", + "lastModified": 1756094250, + "narHash": "sha256-Bkghd2NdQqQfKwSftABMDjnfRMFTJXA/XvvfKVonV/Q=", "owner": "BirdeeHub", "repo": "nixCats-nvim", - "rev": "515fb737c41504df023f9638aa0b63111a881c76", + "rev": "7496b06144a15e44301aacea31c3e1ccdb81546e", "type": "github" }, "original": { @@ -44,11 +45,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1755736253, - "narHash": "sha256-jlIQRypNhB1PcB1BE+expE4xZeJxzoAGr1iUbHQta8s=", + "lastModified": 1756128520, + "narHash": "sha256-R94HxJBi+RK1iCm8Y4Q9pdrHZl0GZoDPIaYwjxRNPh4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "596312aae91421d6923f18cecce934a7d3bfd6b8", + "rev": "c53baa6685261e5253a1c355a1b322f82674a824", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1756128520, + "narHash": "sha256-R94HxJBi+RK1iCm8Y4Q9pdrHZl0GZoDPIaYwjxRNPh4=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c53baa6685261e5253a1c355a1b322f82674a824", "type": "github" }, "original": { diff --git a/templates/n/flake.nix b/templates/n/flake.nix index 6229781..ef343a6 100644 --- a/templates/n/flake.nix +++ b/templates/n/flake.nix @@ -80,18 +80,14 @@ ) ## Define project level Python Packages + ## Only use if uv should not be used ( final: prev: let reqPkgs = pyPackages: with pyPackages; [ - ipython numpy - optuna polars requests - scikit-learn - statsmodels - xgboost ]; in { python = prev.python3.withPackages reqPkgs; @@ -224,31 +220,62 @@ ]; }; }; - m = { + m = let + preHookInit = '' + # Check if pyproject.toml exists + if [ ! -f "pyproject.toml" ]; then + echo "pyproject.toml not found. Initializing new UV project..." + + # Initialize UV project + uv init + + # Check if uv init was successful + if [ $? -eq 0 ]; then + echo "UV project initialized successfully." + + # Add marimo dependency + echo "Adding marimo dependency..." + uv add marimo + + if [ $? -eq 0 ]; then + echo "Marimo added successfully!" + else + echo "Error: Failed to add marimo dependency." + exit 1 + fi + else + echo "Error: Failed to initialize UV project." + exit 1 + fi + else + echo "pyproject.toml already exists. Syncing...." + uv sync + fi + ''; + in { enable = true; path = { - value = "${pkgs.marimo}/bin/marimo"; - args = ["--add-flags" "edit"]; + value = "${pkgs.uv}/bin/uv"; + args = [ + "--run" + "${preHookInit}" + "--add-flags" + "run marimo edit" + ]; }; }; jl = { - enable = true; + enable = false; path = { value = "${pkgs.julia-bin}/bin/julia"; - args = [ - "--add-flags" - "--project=@." - ]; + args = ["--add-flags" "--project=@."]; }; }; r = { enable = true; path = { value = "${pkgs.rWrapper}/bin/R"; - args = [ - "--add-flags" - "--no-save --no-restore" - ]; + args = ["--add-flags" "--no-save --no-restore"]; }; }; node.enable = true; @@ -258,7 +285,7 @@ }; categories = { julia = false; - python = true; + python = false; r = true; project = true; gitPlugins = true;