Variable $NIX_CC not set in zsh in nixos

To patch a binary, I need the environment variable NIX_CC, which seems to be missing in my zsh-session, but is present withing nix-shell -p binutils.
Is it possible to have access to that variable in my zsh-session? Did I miss something else?
Thanks :slight_smile:

My configuration.nix

environment.systemPackages = [
  environment.shells = [ pkgs.zsh ];
  programs.zsh.enable = true;
  users.defaultUserShell = pkgs.zsh;
1 Like

NIX_CC isn’t usually set in the environment.

It’s only set within environments used to build.

So you need to use a properly set up shell to get that variable, alternatively patch within a derivation.


Thanks for the context. I will try to move the patch-process into a derivation