8000 Running nix-shell -p causes locale-related error · Issue #16687 · NixOS/nix · GitHub
[go: up one dir, main page]

Skip to content

Running nix-shell -p causes locale-related error #16687

Open

Description

@ElaConeUmutDeniz

Describe the bug

When I run nix-shell -p with any package, I get the following message: "bash: export: RANLİB=ranlib': geçerli bir tanımlayıcı değil". This is very likely to be specific for my locale, which is Turkish. It gets solved only when I run with LC_ALL=C.

Steps To Reproduce

  1. Set your locale to Turkish
  2. Run nix-shell -p with any package you want
  3. Get the error

Expected behavior

I expected it to run without any environmental variable required.

Metadata

nix-env (Nix) 2.34.8

Activity

  1. Filippo-Galli commented on Oct 30, 2026

    @Filippo-Galli
    Contributor

    Hi! The root cause of this issue actually lives in Nixpkgs rather than the Nix CLI itself (pkgs/build-support/bintools-wrapper/setup-hook.sh).

    What is happening:

    1. Running nix-shell -p runs an impure shell by default, which inherits your terminal's locale (tr_TR.UTF-8).
    2. nix-shell sources $stdenv/setup, which in turn executes the setup hook for bintools-wrapper.
    3. In that setup hook, tool names like ranlib are converted to uppercase to export variables (RANLIB=ranlib).
    4. In the Turkish locale, the lowercase letter i is uppercased to İ (dotted capital İ, U+0130). This turns ranlib into RANLİB.
    5. Because Bash variable identifiers strictly require ASCII characters, Bash rejects RANLİB as an invalid identifier (geçerli bir tanımlayıcı değil).

    I have opened a PR in Nixpkgs with an improved fix that makes these tool variable exports completely locale-independent: NixOS/nixpkgs#581050

    In the meantime, running with LC_ALL=C nix-shell -p ... remains the best workaround until the fix reaches your channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0