Add flake
This commit is contained in:
64
flake.nix
Normal file
64
flake.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
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
|
||||
'';
|
||||
});
|
||||
in
|
||||
{
|
||||
devShells.x86_64-linux.default = pkgs.mkShell rec {
|
||||
name = "R_environment";
|
||||
buildInputs = with pkgs; [
|
||||
# Technical dependencies:
|
||||
R
|
||||
python312Packages.radian
|
||||
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
|
||||
|
||||
];
|
||||
|
||||
# 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/
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user