Rstudio Server Locale Issue

I am trying to get an RStudio server up and running on a nixos server. I am using the below config for it. It largely works fine now, except that I keep getting this warning when an R session starts:

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C" 
2: Setting LC_COLLATE failed, using "C" 
3: Setting LC_TIME failed, using "C" 
4: Setting LC_MESSAGES failed, using "C" 
5: Setting LC_MONETARY failed, using "C" 
6: Setting LC_PAPER failed, using "C" 
7: Setting LC_MEASUREMENT failed, using "C" 

My locale is obviously set in my configuration.nix file. I have tried to use Syst.setlocale() in Rstudio, but obviously the OS won’t allow that. I also tried to add it to services.rstudio-server.rsessionExtraConfig, which didn’t seem to have any effect. I checked and the rstudio systemd service and it includes Environment="LOCALE_ARCHIVE=/nix/store/fiyrsa2vgznb057f3w8lwcfzhqdq0igi-glibc-locales-2.38-27/lib/locale/locale-archive".

Does anyone know a solution to this?
Thanks!

services.rstudio-server = {
    enable = true;
    serverWorkingDir = "/home/$USER/";
    listenAddr = "0.0.0.0";

    package = pkgs.rstudioServerWrapper.override {
      packages = with pkgs.rPackages; [
        languageserver
        tidyverse
        caret
        ...
      ];
    };
  };
  systemd.services.rstudio-server = {
    path = [
      pkgs.git
      pkgs.zip
    ];
  };
1 Like