Unable to set locale

I want to set my locale to en_IN.UTF-8 but unable to do so.

whenever I try to:

# configuration.nix
i18n.defaultLocale = "en_IN.UTF-8";
i18n.supportedLocales = [ "en_IN.UTF-8/UTF-8" ];
$ sudo nixos-rebuild test

this results

error: builder for '/nix/store/dnv5d6njk543618dy84sd89vmrcjhi8x-glibc-locales-2.39-5.drv' failed with exit code 1;
       last 10 log lines:
       > zh_SG/GB2312 \
       > zh_TW.EUC-TW/EUC-TW \
       > zh_TW.UTF-8/UTF-8 \
       > zh_TW/BIG5 \
       > zu_ZA.UTF-8/UTF-8 \
       > zu_ZA/ISO-8859-1 \
       > Error: unsupported locales detected:
       > en_IN.UTF-8/UTF-8 \
       > You should choose from the list above the error.
       > /nix/store/9wnvhjyxjykwn5y06xc9a2h8rs5fbfia-stdenv-linux/setup: line 131: pop_var_context: head of shell_variables not a function context
       For full logs, run 'nix log /nix/store/dnv5d6njk543618dy84sd89vmrcjhi8x-glibc-locales-2.39-5.drv'.
error: 1 dependencies of derivation '/nix/store/pwk7fy1fb3arkyqn00f1y8pf09p4aia3-nixos-system-VSENVY-24.05.19700101.dirty.drv' failed to build

I checked the log and didn’t find en_IN.UTF-8 entry, is this not supported?
Some programs I use are needing to use UTF-8 encoding.

1 Like

try en_IN/UTF-8. see the link here for supported locales: NixOS Search

Thanks for the response, I tried it

  i18n.defaultLocale = "en_IN/UTF-8";
  i18n.supportedLocales = [ "en_IN/UTF-8" ];

and

$ sudo nixos-rebuild test

this is the result

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN/UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
activating the configuration...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN/UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
setting up /etc...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_IN/UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
reloading user units for vanshaj...
restarting sysinit-reactivation.target

I’m not sure what could cause this, I’m on hyprland

share the whole config. definitely something weird’s going on. also do you use channels, not flakes? if so, share the channels too (tho, would be much easier with flakes)

I’m learning, so you know it is not great, here is my github repo for my nixos configuration.
I’ve changed the locale to en_US.UTF-8 just to make it usable for now, which works. And I am using flakes. Thank you for you help.

something’s really off. on my system i’ve just sucessfully dry-built your rev fb6120e (nixos-rebuild --option eval-cache false dry-build --flake .#VSENVY in your flake source directory). could you, after a quick reboot, try building from that rev again?

Your problem is this. en_IN.UTF-8/UTF-8 is not a valid locale.

You don’t need to set that option anyways; it’ll be populated with your defaultLocale by default.