How to find the name of a Nix package to install it in configuration.nix?
29
votes
7
answers
25765
views
Suppose I search for a package to install using [
nix-env
](https://nixos.org/nix/manual/#sec-nix-env) 's [--query
](https://nixos.org/nix/manual/#idm46912466717184) 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](http://nixos.org/nixos/manual/index.html#ch-configuration) :
environment.systemPackages = with pkgs; [
aspell-dict-en
];
Yet if I run sudo nixos-rebuild switch
, NixOS command to [update the configuration](http://nixos.org/nixos/manual/index.html#sec-changing-config) and install all system-wide packages specified by [declaratively](http://nixos.org/nixos/manual/index.html#sec-declarative-package-mgmt) , 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
?
Asked by Mirzhan Irkegulov
(8778 rep)
Dec 18, 2015, 05:37 PM
Last activity: Aug 11, 2024, 05:32 PM
Last activity: Aug 11, 2024, 05:32 PM