NickelEval.jl

Julia FFI bindings for Nickel configuration language
Log | Files | Refs | README | LICENSE

index.md (2664B)


      1 # NickelEval.jl
      2 
      3 Julia bindings for the [Nickel](https://nickel-lang.org/) configuration language, using the official Nickel C API.
      4 
      5 Evaluate Nickel code directly from Julia and get back native Julia types — no CLI, no intermediate files, no serialization overhead.
      6 
      7 ## Features
      8 
      9 - **Direct evaluation** of Nickel expressions and files via the C API
     10 - **Native type mapping** — records become `Dict`, arrays become `Vector`, enums become `NickelEnum`
     11 - **Typed evaluation** — request results as `Dict{String,Int}`, `Vector{Float64}`, `NamedTuple`, etc.
     12 - **Export to JSON, TOML, YAML** — serialize Nickel configurations to standard formats
     13 - **File evaluation with imports** — evaluate `.ncl` files that reference other Nickel files
     14 
     15 ## Documentation
     16 
     17 ```@contents
     18 Pages = [
     19     "man/examples.md",
     20     "man/detailed.md",
     21     "lib/public.md",
     22 ]
     23 Depth = 1
     24 ```
     25 
     26 ## Installation
     27 
     28 ### From the LouLouLibs Registry
     29 
     30 ```julia
     31 using Pkg
     32 Pkg.Registry.add(url="https://github.com/LouLouLibs/loulouJL")
     33 Pkg.add("NickelEval")
     34 ```
     35 
     36 ### From GitHub
     37 
     38 ```julia
     39 using Pkg
     40 Pkg.add(url="https://github.com/LouLouLibs/NickelEval.jl")
     41 ```
     42 
     43 Pre-built native libraries are provided for **macOS (Apple Silicon)** and **Linux (x86\_64)**. On supported platforms, the library downloads automatically when first needed.
     44 
     45 ### Building from Source
     46 
     47 If the pre-built binary doesn't work on your system — or if no binary is available for your platform — you can build the Nickel C API library from source. This requires [Rust](https://rustup.rs/).
     48 
     49 ```julia
     50 using NickelEval
     51 build_ffi()
     52 ```
     53 
     54 This clones the Nickel repository, compiles the C API library with `cargo`, and installs it into the package's `deps/` directory. The FFI is re-initialized automatically — no Julia restart needed.
     55 
     56 You can also trigger the build during package installation:
     57 
     58 ```julia
     59 ENV["NICKELEVAL_BUILD_FFI"] = "true"
     60 using Pkg
     61 Pkg.build("NickelEval")
     62 ```
     63 
     64 ### Older Linux Systems (glibc Compatibility)
     65 
     66 The pre-built Linux binary is compiled against a relatively recent version of glibc. On older distributions — CentOS 7, older Ubuntu LTS, or many HPC clusters — you may see an error like:
     67 
     68 ```
     69 /lib64/libm.so.6: version `GLIBC_2.29' not found
     70 ```
     71 
     72 The fix is to build from source:
     73 
     74 ```julia
     75 using NickelEval
     76 build_ffi()
     77 ```
     78 
     79 This compiles Nickel against your system's glibc, producing a compatible binary. The only requirement is a working Rust toolchain (`cargo`), which can be installed without root access via [rustup](https://rustup.rs/):
     80 
     81 ```bash
     82 curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
     83 ```
     84 
     85 After installing Rust, restart your Julia session and run `build_ffi()`.