I’m trying to build an R package from source, specifically the r-inla package found here. I’ve only done this once before, and it went fine. This time, the error message is not very informative. Can someone help me figure out what I’m missing? Alternatively, is there a way to set environment variables in the flake to allow using R’s nativeinstall.packages() function?
{
description = "Flake for quarto development";
inputs = {
# I'm on unstable, but this should work for you.
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
r-inla = pkgs.rPackages.buildRPackage {
name = "INLA";
src = pkgs.fetchurl {
url = "https://inla.r-inla-download.org/R/stable/src/contrib/INLA_25.10.19.tar.gz"; # Use it from the INLA website instead of GH
sha256 = "0mymw6my8zz2s5v7jp289kf0a3fy9hwb1fr00mk6ga3vfnxf93q1"; # Use nix-prefetch-url to get this
};
};
in {
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
R
# fmesher is a dependency. Doesn't work when adding to propagate build inputs for some reason.
rPackages.fmesher
r-inla
];
};
});
}
> library(INLA)
Loading required package: Matrix
This is INLA_25.10.19 built 2025-10-19 19:10:20 UTC.
- See www.r-inla.org/contact-us for how to get help.
- List available models/likelihoods/etc with inla.list.models()
- Use inla.doc(<NAME>) to access documentation
>