Issue:-
- Aberrant behaviour with an R package when working in a Nix system, specifically coding and reloading the package is not working and produces errors. I need to restart my IDE to evaluate the changes I have made to the code.
Expected outcome:-
- Be able to change my R-code interacting with the R package and not need to re-start my IDE everytime I make a change.
Details:-
- Nix version:- 24.05
- R-shiny (the relevant r package):- 1.8.0
I am using the rPackages.Shiny
package available here nixpkgs/pkgs/development/r-modules/generic-builder.nix at 9256f7c71a195ebe7a218043d9f93390d49e6884 · NixOS/nixpkgs · GitHub . I am using it as it without any changes of my own.
Here is what my the relevant section of my config looks like:-
RStudio-with-my-packages = rstudioWrapper.override{
packages = with rPackages; [
ggplot2
ggtree
igraph
ggpubr
dplyr
shiny
tidyverse
bigsnpr
data_table
bslib
svglite
ggExtra
ape
phylotools
argparse
rPackages.IRkernel
rPackages.languageserver
];
};
I am trying to build a Shiny App for my employer and playing with sample code from the Shiny tutorial available here:-
library(shiny)
# Define UI ----
ui <- page_fluid(
titlePanel("Basic widgets"),
layout_columns(
col_width = 3,
card(
card_header("Buttons"),
actionButton("action", "Action"),
submitButton("Submit")
),
card(
card_header("Single checkbox"),
checkboxInput("checkbox", "Choice A", value = TRUE)
),
card(
card_header("Checkbox group"),
checkboxGroupInput(
"checkGroup",
"Select all that apply",
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)
),
card(
card_header("Date input"),
dateInput("date", "Select date", value = "2014-01-01")
),
card(
card_header("Date range input"),
dateRangeInput("dates", "Select dates")
),
card(
card_header("File input"),
fileInput("file", label = NULL)
),
card(
card_header("Help text"),
helpText(
"Note: help text isn't a true widget,",
"but it provides an easy way to add text to",
"accompany other widgets."
)
),
card(
card_header("Numeric input"),
numericInput("num", "Input number", value = 1)
),
card(
card_header("Radio buttons"),
radioButtons(
"radio",
"Select option",
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)
),
card(
card_header("Select box"),
selectInput(
"select",
"Select option",
choices = list("Choice 1" = 1, "Choice 2" = 2, "Choice 3" = 3),
selected = 1
)
),
card(
card_header("Sliders"),
sliderInput(
"slider1",
"Set value",
min = 0,
max = 100,
value = 50
),
sliderInput(
"slider2",
"Set value range",
min = 0,
max = 100,
value = c(25, 75)
)
),
card(
card_header("Text input"),
textInput("text", label = NULL, value = "Enter text...")
)
)
)
# Define server logic ----
server <- function(input, output) {
}
# Run the app ----
shinyApp(ui = ui, server = server)
The code produces a working output the first time around but everytime I make a change and reaload the app, I get the following error:-
Warning in file.copy(script, dirname(outfile), overwrite = TRUE) :
problem copying /nix/store/m81gr51dvwn9bd2b6w5gzy0qsnm36cwv-r-shiny-1.8.0/library/shiny/www/shared/selectize//js/selectize.min.js to /tmp/RtmpHhtDgJ/selectize6266c6e8c47f24e0f16990664c14d764/selectize.min.js: Permission denied
Warning in file.copy(script, dirname(outfile), overwrite = TRUE) :
problem copying /nix/store/m81gr51dvwn9bd2b6w5gzy0qsnm36cwv-r-shiny-1.8.0/library/shiny/www/shared/selectize//accessibility/js/selectize-plugin-a11y.min.js to /tmp/RtmpHhtDgJ/selectize6266c6e8c47f24e0f16990664c14d764/selectize-plugin-a11y.min.js: Permission denied
Warning: Error in bslib::bs_dependency: Failed to copy the following script(s): /nix/store/m81gr51dvwn9bd2b6w5gzy0qsnm36cwv-r-shiny-1.8.0/library/shiny/www/shared/selectize//js/selectize.min.js, /nix/store/m81gr51dvwn9bd2b6w5gzy0qsnm36cwv-r-shiny-1.8.0/library/shiny/www/shared/selectize//accessibility/js/selectize-plugin-a11y.min.js.
Make sure script are absolute path(s).
My best guess is that I am stuck somewhere between Nix and R not meshing well with each other - but I am not being able to figure out how to solve it or it it can be solved without working with the underlying Nix config for the package (not sure if that is the jargon for the rPackage.Shiny code).
What can I do to debug this issue?