Skip to content

Commit

Permalink
sha256
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Rodrigues committed Aug 4, 2023
1 parent 2c6ecfd commit 72abc18
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 42 deletions.
48 changes: 7 additions & 41 deletions dev/interactive_use.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -52,56 +52,22 @@ rstudio
```

Name this script something like `kmeans_project`, make it executable (using
`chmod +x kmeans_project`) and now you can run RStudio within this environment
`chmod +x kmeans_project`), and now you can run RStudio within this environment
from anywhere.

## Scenario 2: you install R and RStudio using Nix

In case you don't have R installed, you cannot use the `{rix}` package to
generate new expressions. In this case you might consider installing Nix first,
and then running this inside your terminal to get dropped into a temporary
Nix shell, which you can then use to generate new `default.nix` files:
If you don't have R installed you cannot use the `{rix}` package to generate new
expressions. In this case you might consider installing Nix first, and then
running the following command inside your terminal to get dropped into a
temporary Nix shell, which you can then use to generate new `default.nix` files:

```
nix-shell --expr "$(curl -sl https://raw.githubusercontent.com/b-rodrigues/rix/master/inst/extdata/default.nix)"
```

This expression that gets built is this one:

```
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/8ad5e8132c5dcf977e308e7bf5517cc6cc0bf7d8.tar.gz") {} }:
with pkgs;
let
bootstrap_env = rWrapper.override {
packages = with rPackages; [
(buildRPackage {
name = "rix";
src = fetchgit {
url = "https://github.com/b-rodrigues/rix/";
branchName = "master";
rev = "935fb194b38adfb085a5bda9ebe5dc5bb504f2cb";
sha256 = "sha256-qMKcBcoemx3CcayA0Vt3LcDCAskhWyWXJBJVN8BaIOw=";
};
propagatedBuildInputs = [
httr
jsonlite
];
})
];
};
in
mkShell {
buildInputs = [bootstrap_env];
shellHook = "R";
}
```

Running the command above will immediately start an R session inside your
terminal. You can now run something like this:
Running the command above will download R and `{rix}` and then start an R
session inside your terminal. You can now run something like this:

```
rix(r_ver = "current",
Expand Down
2 changes: 1 addition & 1 deletion inst/extdata/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
url = "https://github.com/b-rodrigues/rix/";
branchName = "master";
rev = "d505382ad8ef759a8257227a19043e228a6d70dd";
sha256 = "sha256-axmHWXNEL2c00TQGYJEwrgVNkLbbNhrx/LHkzuMa9QM=";
sha256 = "sha256-vLb7y/6K3iNy8Hb5XmwksAgq5R6yT14JfbDFVPtt2ZY=";
};
propagatedBuildInputs = [
httr
Expand Down

0 comments on commit 72abc18

Please sign in to comment.