How to correct set LC_ALL and LANGUAGE

I don’t understand how to fix this error.
I add

i18n.glibcLocales = lib.hiPrio (pkgs.buildPackages.glibcLocales.override {
  allLocales = lib.any (x: x == "all") config.i18n.supportedLocales;
  locales = config.i18n.supportedLocales;
});

and got error:

undefined variable 'lib' at /etc/nixos/configuration.nix:48:23
(use '--show-trace' to show detailed location information)
building Nix...
error: undefined variable 'lib' at /etc/nixos/configuration.nix:48:23
(use '--show-trace' to show detailed location information)
building the system configuration...
error: undefined variable 'lib' at /etc/nixos/configuration.nix:48:23
(use '--show-trace' to show detailed location information)