Open raymondhoagland opened 7 years ago
Installing glibcLocales seems to allow me to properly set the encoding with
export LC_ALL="en_US.utf-8"
export LANG="en_US.utf-8"
at various points, but none of which have any real impact. Adding a custom gemConfig doesn't help because it's not the actual build of the gem that is having issues, and the postBuild action is applied after stubbing so it's already failed.
The best workaround I've been able to come up with so far is to circumvent bundlerEnv by using buildRubyGem and maintaining a secondary gemset.nix file that only has xcode-install
and its dependencies. If there's a better way to do this I'd still like to know because this seems like bad practice.
I believe the issue you are running into is in building the dependencies for your shell environment, and in the environment those dependencies are build, only the C and POSIX locales are available so it really doesn't matter what you set LANG
or LC_*
to.
You can see this by looking at the output locale -a
gives in the standard builder environment
nix build '(with import <nixpkgs> { }; runCommandCC "locales" { } "locale -a")'
nix-store -l <path of derivation>
C
POSIX
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Issue description
When trying to install certain gems through bundlerEnv (namely xcode-install) the nix-shell crashes while building packages, specifically when trying to execute gen-bin-stubs.rb for the gem.
Trying to track down the issue, it looks like the problem is that one of the executables uses the 🎉 symbol which isn't ASCII-safe and the script ultimately breaks here.
Modifying the gen-bin-stubs script and printing out the
LC_ALL
andLANG
ENV values leads me to believe bundlerEnv is wiping the environment out as they both end up nil. Checking the default external_encoding in the script thereby shows Ruby is usingUS-ASCII
, which causes the encoding snafu.Is there any way to properly inject these variables into the bundlerEnv to account for this? Manually changing the script to read the file as UTF-8 gets around the problem but I'm pretty sure that's not a good fix-all. Workaround looks like
Another alternative (again not a great solution) is to set the default external encoding at the beginning of gen-bin-stubs through
The actual environment settings (outside of nix) uses
Relevant piece of the default.nix script
Steps to reproduce
Create a gemfile with xcode-install, generate the Gemfile.lock, and define the gemset.nix using bundix. Running nix-shell should display the error. (e.g.)
Technical details
System: Darwin Nix version: 1.11.7 Nixpkgs version: 17.09pre102933.26625c9 Sandboxing enabled: no