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:
copilot-swe-agent[bot] 2026-01-11 19:26:17 +00:00
commit 3398a72241
17 changed files with 1185 additions and 422 deletions

View file

@ -0,0 +1,8 @@
# Merges all host configurations from separate modules
config: pkgs: let
pythonHosts = import ./python.nix config pkgs;
juliaHosts = import ./julia.nix config pkgs;
rHosts = import ./r.nix config pkgs;
utilsHosts = import ./utils.nix config pkgs;
in
pythonHosts // juliaHosts // rHosts // utilsHosts

View file

@ -0,0 +1,34 @@
# Julia-related host configurations
config: pkgs: {
jl = {
enable = config.enabledLanguages.julia;
path = {
value = "${pkgs.julia-bin}/bin/julia";
args = ["--add-flags" "--project=."];
};
};
initJl = {
enable = config.enabledLanguages.julia;
path = {
value = "${pkgs.julia-bin}/bin/julia";
args = ["--add-flags" "--project=. -e 'using Pkg; Pkg.instantiate(); Pkg.add(\"Pluto\")'"];
};
};
pluto = let
runPluto = ''
import Pkg; import TOML; Pkg.instantiate();
if !isfile("Project.toml") || !haskey(TOML.parsefile(Base.active_project())["deps"], "Pluto")
Pkg.add("Pluto");
end
import Pluto; Pluto.run();
'';
in {
enable = config.enabledLanguages.julia;
path = {
value = "${pkgs.julia-bin}/bin/julia";
args = ["--add-flags" "--project=. -e '${runPluto}'"];
};
};
}

View 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";
};
}

10
templates/rde/hosts/r.nix Normal file
View file

@ -0,0 +1,10 @@
# R-related host configurations
config: pkgs: {
r = {
enable = config.enabledLanguages.r;
path = {
value = "${pkgs.rWrapper}/bin/R";
args = ["--add-flags" "--no-save --no-restore"];
};
};
}

View file

@ -0,0 +1,53 @@
# Utility and common host configurations
config: pkgs: {
g = {
enable = true;
path = {
value = "${pkgs.neovide}/bin/neovide";
args = [
"--add-flags"
"--neovim-bin ${config.defaultPackageName}"
];
};
};
initProject = {
enable = true;
path = {
value = "${pkgs.initProject}/bin/initProject";
};
};
initDevenv = {
enable = config.enabledPackages.devenv;
path = {
value = "${pkgs.devenv}/bin/devenv";
args = ["--add-flags" "init"];
};
};
activateDevenv = {
enable = config.enabledPackages.devenv;
path = {
value = "${pkgs.activateDevenv}/bin/activateDevenv";
};
};
devenv = {
enable = config.enabledPackages.devenv;
path = {
value = "${pkgs.devenv}/bin/devenv";
};
};
updateDeps = {
enable = true;
path = {
value = "${pkgs.updateDeps}/bin/updateDeps";
};
};
node.enable = true;
perl.enable = true;
ruby.enable = true;
}