Suppose I search for a package to install using nix-env
's --query
operation:
$ nix-env -qa 'aspell.*en'
aspell-dict-en-7.1-0
I write this package name in /etc/nixos/configuration.nix
, NixOS's main configuration file:
environment.systemPackages = with pkgs; [
aspell-dict-en
];
Yet if I run sudo nixos-rebuild switch
, NixOS command to update the configuration and install all system-wide packages specified by declaratively, it aborts with an error:
error: undefined variable ‘aspell-dict-en’ at /etc/nixos/configuration.nix:44:5
I know that for many packages, although not all, the name that nix-env
returns and the name one should specify in environment.systemPackages
configuration option are different, but I don't understand the logic. How do I install a package that I found through nix-env
?