Hi,
Was trying to setup Data Science environment in idx but couldn’t . Seems like idx can’t find rPackages. Any workaround?
Here’s my dev.nix config for reference :
# dev.nix configuration with correct R package
{ pkgs, ... }: {
channel = "stable-24.05"; # Choose the appropriate nixpkgs channel
packages = [
pkgs.rPackages.tidyverse # Equivalent to using rocker/tidyverse in Dockerfile
pkgs.rPackages.iRkernel # Jupyter kernel for R
pkgs.python311Packages.jupyterlab # JupyterLab environment
pkgs.rPackages.quarto # Quarto CLI for literate programming and markdown
pkgs.python311 # Python3 for JupyterLab, etc.
pkgs.python311Packages.pip # Python package installer
pkgs.rstudio
pkgs.rstudio-server
];
# Set environment variables for the workspace
env = {
RSTUDIO_PORT = "8787";
JUPYTER_PORT = "8888";
};
idx = {
extensions = [
# Equivalent VS Code extensions from open-vsx
"REditorSupport.r"
"ms-toolsai.jupyter"
"ms-python.python"
"ms-python.vscode-pylance"
"GitHub.copilot"
"vsls-contrib.codetour"
];
# Workspace lifecycle hooks
workspace = {
# Runs when a workspace is first created
onCreate = {
# Install any Python dependencies mentioned in the requirements.txt file
install-deps = "pip install --user -r requirements.txt";
# Default open files like the dev.nix and README.md files
default.openFiles = [ ".idx/dev.nix" "README.md" ];
};
# Runs when the workspace is (re)started
onStart = {
# Start RStudio Server when the workspace starts
start-rstudio = "rstudio-server start";
# Start JupyterLab without authentication
start-jupyter = ''
jupyter lab \
--ServerApp.ip="0.0.0.0" \
--ServerApp.allow_origin="*" \
--ServerApp.port=8888 \
--ServerApp.token="" \
--ServerApp.password="" \
--no-browser &
'';
};
};
};
}