Skip to content

Commit

Permalink
Add R environment
Browse files Browse the repository at this point in the history
Contains minimal knitr dependencies for generating reports
  • Loading branch information
nueidris committed Feb 14, 2024
1 parent cb94157 commit f47b72e
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Once your preferred template has been initialized, you can use the provided shel
| [Protobuf] | [`protobuf`](./protobuf/) |
| [Pulumi] | [`pulumi`](./pulumi/) |
| [Purescript] | [`purescript`](./purescript/) |
| [R] | [`r`](./r/) |
| [Ruby] | [`ruby`](./ruby/) |
| [Rust] | [`rust`](./rust/) |
| [Scala] | [`scala`](./scala/) |
Expand Down Expand Up @@ -223,6 +224,12 @@ The sections below list what each template includes. In all cases, you're free t
- [pip] 23.0.1
- [Virtualenv] 20.19.0

### [`r`](./r/)

- [R] 4.3.1
- [rmarkdown] 2.22
- [knitr] 1.43 ([pandoc] and [texlive])

### [`ruby`](./ruby/)

- [Ruby] 3.2.2, plus the standard Ruby tools (`bundle`, `gem`, etc.)
Expand Down Expand Up @@ -300,6 +307,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[iex]: https://hexdocs.pm/iex/IEx.html
[java]: https://java.com
[jq]: https://jqlang.github.io/jq
[knitr]: https://yihui.org/knitr/
[kotlin]: https://kotlinlang.org
[latex]: https://www.latex-project.org/
[leiningen]: https://leiningen.org
Expand Down Expand Up @@ -328,6 +336,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[odoc]: https://github.com/ocaml/odoc
[omnisharp-roslyn]: https://github.com/OmniSharp/omnisharp-roslyn
[opa]: https://openpolicyagent.org
[pandoc]: https://pandoc.org/
[packer]: https://packer.io
[pip]: https://pypi.org/project/pip
[phoenix]: https://phoenixframework.org
Expand All @@ -339,7 +348,9 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T
[purescript-language-server]: https://github.com/nwolverson/purescript-language-server
[purs-tidy]: https://github.com/natefaubion/purescript-tidy
[python]: https://python.org
[r]: https://www.r-project.org/
[release]: https://github.com/NixOS/nixpkgs/releases/tag/22.11
[rmarkdown]: https://rmarkdown.rstudio.com/
[ruby]: https://ruby-lang.org
[rust]: https://rust-lang.org
[rust-analyzer]: https://rust-analyzer.github.io
Expand Down
5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@
description = "Python development environment";
};

r = {
path = ./r;
description = "R development environment";
};

ruby = {
path = ./ruby;
description = "Ruby development environment";
Expand Down
1 change: 1 addition & 0 deletions r/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
27 changes: 27 additions & 0 deletions r/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions r/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = "A Nix-flake-based R development environment";

inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";

outputs = { self, nixpkgs }:
let
overlays = [
(final: prev: rec {
rEnv = prev.rWrapper.override {
packages = with prev.rPackages; [ knitr ];
};
})
];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit overlays system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs;
[ rEnv
pandoc
texlive.combined.scheme-full
];
};
});
};
}

0 comments on commit f47b72e

Please sign in to comment.