mirror of
https://github.com/dwinkler1/np.git
synced 2026-02-19 22:40:57 -05:00
Refactor template: extract scripts, overlays, and hosts into separate modules
Co-authored-by: dwinkler1 <22460147+dwinkler1@users.noreply.github.com>
This commit is contained in:
parent
5e8f07c560
commit
3398a72241
17 changed files with 1185 additions and 422 deletions
82
templates/rde/hosts/python.nix
Normal file
82
templates/rde/hosts/python.nix
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# Python-related host configurations
|
||||
config: pkgs: {
|
||||
marimo = let
|
||||
marimoInit = ''
|
||||
set -euo pipefail
|
||||
if [[ ! -f "pyproject.toml" ]]; then
|
||||
echo "🐍 Initializing UV project..."
|
||||
uv init
|
||||
echo "📦 Adding Marimo..."
|
||||
uv add marimo
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo "✅ Python project initialized!"
|
||||
echo "run 'uv add PACKAGE' to add more python packages."
|
||||
echo "--------------------------------------------------------------------------"
|
||||
else
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo "🔄 Syncing existing project..."
|
||||
uv sync
|
||||
echo "🐍 Launching Marimo..."
|
||||
echo "--------------------------------------------------------------------------"
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
enable = config.enabledLanguages.python;
|
||||
path = {
|
||||
value = "${pkgs.uv}/bin/uv";
|
||||
args = [
|
||||
"--run"
|
||||
"${marimoInit}"
|
||||
"--add-flags"
|
||||
"run marimo edit \"$@\""
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
py = {
|
||||
enable = config.enabledLanguages.python;
|
||||
path = {
|
||||
value = "${pkgs.python.interpreter}";
|
||||
};
|
||||
};
|
||||
|
||||
ipy = let
|
||||
ipythonInit = ''
|
||||
set -euo pipefail
|
||||
if [[ ! -f "pyproject.toml" ]]; then
|
||||
echo "🐍 Initializing UV project..."
|
||||
uv init
|
||||
echo "📦 Adding IPython..."
|
||||
uv add ipython
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo "✅ Python project initialized!"
|
||||
echo "run 'uv add PACKAGE' to add more python packages."
|
||||
echo "--------------------------------------------------------------------------"
|
||||
else
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo "🔄 Syncing existing project..."
|
||||
echo "📦 Ensuring IPython is installed..."
|
||||
uv add ipython
|
||||
uv sync
|
||||
echo "🐍 Launching IPython..."
|
||||
echo "--------------------------------------------------------------------------"
|
||||
fi
|
||||
'';
|
||||
in {
|
||||
enable = config.enabledLanguages.python;
|
||||
path = {
|
||||
value = "${pkgs.uv}/bin/uv";
|
||||
args = [
|
||||
"--run"
|
||||
"${ipythonInit}"
|
||||
"--add-flags"
|
||||
"run ipython \"$@\""
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
initPython = {
|
||||
enable = config.enabledLanguages.python;
|
||||
path.value = "${pkgs.initPython}/bin/initPython";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue