Jqr rPackage error

I’m trying to install some R packages, and I encounter this error on jqr:

sh: ./configure: /bin/bash: bad interpreter: No such file or directory
ERROR: configuration failed for package 'jqr'

I’m not sure how to proceed, as R packages are installed with a single wrapper function and are “autogenerated”.
How should I proceed?

It looks like jqr’s configure script contains a NixOS-incompatible shebang:

#!/bin/bash

which the Nix jqr package should replace with something like

#!${pkgs.bash}/bin/bash

or maybe even

#!/usr/bin/env bash

I’m not familiar with the Nix code that autogenerates R packages, but I’m guessing it fails to make such a replacement. Probably worth bringing up at Issues · NixOS/nixpkgs · GitHub (unless an issue for it already exists).

I played around with it, trying a shell.nix that contains:

rEnv = pkgs.rWrapper.override {
  packages = with pkgs.rPackages; [
    (jqr.override {
      preConfigure = "sed -i 's|/bin/bash|${pkgs.bash}/bin/bash|' $out/configure";
    })
  ];
};

but this doesn’t actually work. The way the r-modules are set up, preConfigure can not be passed in via an override like that. There’s probably another way… hopefully someone more knowledgeable will chime in with a feasible workaround.

I see some similar issues addressed for other packages in r-modules/default.nix, e.g.

curl = old.curl.overrideDerivation (attrs: {
  preConfigure = "patchShebangs configure";
});

It looks like there’s a way to provide rPackageOverrides. I see this in top-level/default.nix:

rPackages = callPackage ../development/r-modules {
  overrides = (config.rPackageOverrides or (p: {})) pkgs;
};

but I haven’t yet figured out how to use it.

Thanks! It’s reassuring that I’m not the only one having trouble with that :slight_smile:

I’ll try some more, and then open a ticket.

I was able to build the packages with following override


  jqr.overrideAttrs (super: {
    buildInputs = super.buildInputs ++ (with import <nixpkgs>{}; [jq]);
    patchPhase = ''
      patchShebangs ./configure
    '';
  });

But this is also a hack. Maybe report to nixpkgs?

1 Like

For the life of me, I cannot figure out how to use the rPackageOverrides attribute correctly. This shell.nix results in error: attribute 'jqr' missing.

let
  rPackageOverrides = p: {
    jqr = p.jqr.overrideDerivation (attrs: {
      preConfigure = "patchShebangs configure";
    });
  };
  pkgs = import <nixpkgs> {
    config = { inherit rPackageOverrides; };
  };
  rEnv = pkgs.rWrapper.override {
    packages = with pkgs.rPackages; [ jqr ];
  };
in with pkgs; mkShell {
  name = "test-jqr";
  version = "1.0.0";
  buildInputs = [ rEnv ];
}

I’d recommend adding an issue for the broken jqr package. Maybe an issue for documenting how to use rPackageOverrides correctly too.

Done: jqr rPackage error · Issue #45295 · NixOS/nixpkgs · GitHub

Thanks!