How do I set an environment variable for Firefox?

Firefox has a defect that can be worked around by unsetting LC_TIME. I tried wrapping it—

pkgs.firefox-wayland.overrideAttrs (a: {
  postInstall = a.postInstall or "" + ''
    wrapProgram "$out/bin/firefox" \
      --unset 'LC_TIME'
  '';
})

—but that appears to have no effect; I don’t see the wrapper in the output. What am I doing wrong?

Can you show more of your configuration? Maybe it’s in the context.

Running :e firefox-wayland shows that it is defined in pkgs/applications/networking/browsers/firefox/wrapper.nix and uses custom buildCommand rather then the default genericBuild implementation. postInstall will therefore have no effect.

I see, thanks, overriding buildCommand works:

pkgs.firefox-wayland.overrideAttrs (a: {
  buildCommand = a.buildCommand + ''
    wrapProgram "$executablePath" \
      --unset 'LC_TIME'
  '';
})

Think I should stop here or is there a better way to do it?

LC_TIME is set in my configuration here.

That rebuilds firefox, right? You might be able to avoid rebuilding it if you wrap the wrapper instead. No, it’s already a wrapper.

en_DK for ISO date/time formatting is a cool tip, by the way, thanks!

1 Like