Skip to contents

Creates a Nix expression with shared logic for R and Python file reading.

Usage

rxp_file_common(
  out_name,
  path,
  nix_env,
  build_phase,
  type,
  derivation_func,
  library_ext,
  env_var = NULL
)

Arguments

out_name

Character, the name of the derivation as a string.

path

Character, the file path (URL or local) or folder path.

nix_env

Character, path to the Nix environment file.

build_phase

Character, the language-specific build phase script.

type

Character, the type of derivation ("rxp_r" or "rxp_py").

derivation_func

Character, the Nix derivation function ("makeRDerivation" or "makePyDerivation").

library_ext

Character, the library file extension ("R" or "py").

env_var

List, defaults to NULL. A named list of environment variables to set before running the script, e.g., c(DATA_PATH = "/path/to/data"). Each entry will be added as an export statement in the build phase.

Value

A list with name, snippet, type, and nix_env.

Examples

if (FALSE) { # \dontrun{
  rxp_file_common(
    out_name = out_name,
    path = actual_path,
    nix_env = nix_env,
    build_phase = build_phase,
    type = "rxp_r",
    derivation_func = "makeRDerivation",
    library_ext = "R",
    env_var = env_var
  )
} # }