diff --git a/README.md b/README.md index 9196b03..305f0ae 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,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/) | @@ -249,6 +250,12 @@ A dev template that's fully customizable. - [Python] 3.11.4 - [pip] 23.0.1 +### [`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.) @@ -342,6 +349,7 @@ All of the templates have only the root [flake](./flake.nix) as a flake input. T [java]: https://java.com [jdtls]: https://projects.eclipse.org/projects/eclipse.jdt.ls [jq]: https://jqlang.github.io/jq +[knitr]: https://yihui.org/knitr/ [kotlin]: https://kotlinlang.org [latex]: https://www.latex-project.org/ [lcov]: https://ltp.sourceforge.net/coverage/lcov.php @@ -371,6 +379,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 @@ -382,7 +391,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 diff --git a/flake.nix b/flake.nix index f4c94e5..b48f42c 100644 --- a/flake.nix +++ b/flake.nix @@ -226,6 +226,11 @@ description = "Python development environment"; }; + r = { + path = ./r; + description = "R development environment"; + }; + ruby = { path = ./ruby; description = "Ruby development environment"; diff --git a/r/.envrc b/r/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/r/.envrc @@ -0,0 +1 @@ +use flake diff --git a/r/flake.lock b/r/flake.lock new file mode 100644 index 0000000..0f56f8b --- /dev/null +++ b/r/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1689261696, + "narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "df1eee2aa65052a18121ed4971081576b25d6b5c", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/r/flake.nix b/r/flake.nix new file mode 100644 index 0000000..da334ef --- /dev/null +++ b/r/flake.nix @@ -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 + ]; + }; + }); + }; +}