Following instructions on the wiki, I have successfully created a nix expression to build R with the packages I use. I installed it into my user profile, and it works.
{
packageOverrides = super: let self = super.pkgs; in
{
rEnv = super.rWrapper.override {
packages = with self.rPackages; [
ggplot2
lubridate
reshape2
tidyverse
xts
];
};
};
}
However, I’m on a single-user machine, so I would like to be able to rebuild everything using nixos-rebuild switch
. So I put the above expression into a file called /etc/nixos/R.nix
, and then used it in /etc/nixos/configuration.nix
like so
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
/etc/nixos/R.nix
];
. . .
environment.systemPackages = with pkgs; [
. . .
rEnv
. . .
];
I got the following error message.
# nixos-rebuild switch
error: The option `packageOverrides' defined in `/etc/nixos/R.nix' does not exist.
(use '--show-trace' to show detailed location information)
building Nix...
error: The option `packageOverrides' defined in `/etc/nixos/R.nix' does not exist.
(use '--show-trace' to show detailed location information)
building the system configuration...
error: The option `packageOverrides' defined in `/etc/nixos/R.nix' does not exist.
(use '--show-trace' to show detailed location information)
What am I doing wrong?