{
  description = "R development shell";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs =
    { self, nixpkgs, ... }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };
      quarto = pkgs.quarto.overrideAttrs (oldAttrs: rec {
        installPhase = ''
          runHook preInstall

          mkdir -p $out/bin $out/share

          mv bin/* $out/bin
          mv share/* $out/share

          runHook postInstall
        '';
      });
      # r_profoc = pkgs.rPackages.buildRPackage {
      #   name = "profoc";
      #   src = pkgs.fetchFromGitHub {
      #     owner = "BerriJ";
      #     repo = "profoc";
      #     rev = "0.9.3";
      #     sha256 = "GakgyUJnlBRXSuct6Gxgn/V1hOSMryCZbJ6DJP1tV1M=";
      #   };
      #   propagatedBuildInputs = with pkgs.rPackages; [
      #     Rcpp
      #     Matrix
      #     abind
      #     RcppArmadillo
      #     RcppProgress
      #     splines2
      #   ];
      # };
    in
    {
      devShells.x86_64-linux.default = pkgs.mkShell rec {
        name = "R_environment";
        buildInputs = with pkgs; [
          # Technical dependencies:
          R
          python312Packages.radian
          pandoc
          quarto
          rPackages.languageserver
          rPackages.lintr
          rPackages.styler
          rPackages.httpgd
          rPackages.crayon
          rPackages.cli

          # Actual R packages needed for the project:
          rPackages.quarto
          rPackages.tidyverse
          rPackages.data_table
          rPackages.anytime
          rPackages.dbx
          rPackages.RMySQL
          rPackages.gamlss
          rPackages.forecast
          rPackages.tictoc
          rPackages.xaringan
          rPackages.xaringanExtra
          rPackages.rmarkdown
          rPackages.kableExtra
          rPackages.gt
          rPackages.plotly
          rPackages.latex2exp
          rPackages.RefManageR
          rPackages.gganimate
          rPackages.cowplot
          rPackages.xtable
          rPackages.profoc

        ];

        # Creating a symlink to the radian binary in the .bin directory is certainly not ideal. There is an isue on that: "https://github.com/REditorSupport/vscode-R/issues/1347"
        # But it is the best way to make it work for now I guess.
        shellHook = ''
          mkdir -p .bin
          ln -sf ${pkgs.python312Packages.radian}/bin/radian .bin/
        '';
      };
    };
}
