no longer load most software by default and automatic marimo installation via uv

This commit is contained in:
Daniel Winkler 2025-08-26 11:30:17 +10:00
commit 71d533fcea
3 changed files with 74 additions and 27 deletions

3
.gitignore vendored
View file

@ -1,2 +1,5 @@
.DS_Store .DS_Store
.direnv .direnv
.python-version
pyproject.toml
uv.lock

35
templates/n/flake.lock generated
View file

@ -6,6 +6,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"nixpkgs-unstable": "nixpkgs-unstable",
"plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references", "plugins-cmp-pandoc-references": "plugins-cmp-pandoc-references",
"plugins-cmp-r": "plugins-cmp-r", "plugins-cmp-r": "plugins-cmp-r",
"plugins-r": "plugins-r", "plugins-r": "plugins-r",
@ -14,11 +15,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1755872133, "lastModified": 1756169393,
"narHash": "sha256-E9GBi7PYnFSjMkovuEYK87hl8+POko9ZXMAY3hZFNBU=", "narHash": "sha256-088/iAKxFGxSCIP5TZvDVtljJIaNXVOp4AjL4iYxF88=",
"owner": "dwinkler1", "owner": "dwinkler1",
"repo": "nixCatsConfig", "repo": "nixCatsConfig",
"rev": "63953ae7d806b91e339a7da241751a033a6d9979", "rev": "1f4d59fc8566681f5fa957dfd57ed1d1311b601a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -29,11 +30,11 @@
}, },
"nixCats_2": { "nixCats_2": {
"locked": { "locked": {
"lastModified": 1755685723, "lastModified": 1756094250,
"narHash": "sha256-WU7yfMmEbYmJnTWPe0RQpZyjf3c+btJ3BfE9RlnTtU0=", "narHash": "sha256-Bkghd2NdQqQfKwSftABMDjnfRMFTJXA/XvvfKVonV/Q=",
"owner": "BirdeeHub", "owner": "BirdeeHub",
"repo": "nixCats-nvim", "repo": "nixCats-nvim",
"rev": "515fb737c41504df023f9638aa0b63111a881c76", "rev": "7496b06144a15e44301aacea31c3e1ccdb81546e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -44,11 +45,27 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1755736253, "lastModified": 1756128520,
"narHash": "sha256-jlIQRypNhB1PcB1BE+expE4xZeJxzoAGr1iUbHQta8s=", "narHash": "sha256-R94HxJBi+RK1iCm8Y4Q9pdrHZl0GZoDPIaYwjxRNPh4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "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" "type": "github"
}, },
"original": { "original": {

View file

@ -80,18 +80,14 @@
) )
## Define project level Python Packages ## Define project level Python Packages
## Only use if uv should not be used
( (
final: prev: let final: prev: let
reqPkgs = pyPackages: reqPkgs = pyPackages:
with pyPackages; [ with pyPackages; [
ipython
numpy numpy
optuna
polars polars
requests requests
scikit-learn
statsmodels
xgboost
]; ];
in { in {
python = prev.python3.withPackages reqPkgs; 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; enable = true;
path = { path = {
value = "${pkgs.marimo}/bin/marimo"; value = "${pkgs.uv}/bin/uv";
args = ["--add-flags" "edit"]; args = [
"--run"
"${preHookInit}"
"--add-flags"
"run marimo edit"
];
}; };
}; };
jl = { jl = {
enable = true; enable = false;
path = { path = {
value = "${pkgs.julia-bin}/bin/julia"; value = "${pkgs.julia-bin}/bin/julia";
args = [ args = ["--add-flags" "--project=@."];
"--add-flags"
"--project=@."
];
}; };
}; };
r = { r = {
enable = true; enable = true;
path = { path = {
value = "${pkgs.rWrapper}/bin/R"; value = "${pkgs.rWrapper}/bin/R";
args = [ args = ["--add-flags" "--no-save --no-restore"];
"--add-flags"
"--no-save --no-restore"
];
}; };
}; };
node.enable = true; node.enable = true;
@ -258,7 +285,7 @@
}; };
categories = { categories = {
julia = false; julia = false;
python = true; python = false;
r = true; r = true;
project = true; project = true;
gitPlugins = true; gitPlugins = true;