Stream: general

Topic: nixos


davidtwco (Apr 22 2019 at 08:10, on Zulip):

@nagisa I've just started using NixOS. I'd tried it one or two times before but didn't have the time to sink into working it all out. Do you have a shell.nix you use w/ rustc? I've thrown together something basic but it's probably solving things in less-than-idiomatic ways.

For example, I found that unless I set LD_LIBRARY_PATH="./build/x86_64-unknown-linux-gnu/stage1/lib"; then running (a stage1) rustc manually wouldn't find the standard library.

nagisa (Apr 22 2019 at 09:27, on Zulip):

For me python x.py "just" works, I don’t really fiddle with manually launching stage1 any more

nagisa (Apr 22 2019 at 09:27, on Zulip):

for general rust development I just use the rust overlay https://github.com/mozilla/nixpkgs-mozilla/blob/master/rust-overlay.nix

davidtwco (Apr 22 2019 at 09:29, on Zulip):

Thanks, I'd seen that but hadn't had to use it yet.

Alexey Shmalko (Apr 22 2019 at 17:59, on Zulip):

Here is my default.nix I use for rustc: https://gist.github.com/rasendubi/2f5e6fc9f74295d518556c34c2f995b2

eddyb (Apr 26 2019 at 06:55, on Zulip):

env NIX_AFFINITY_HACK=0 SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt nix-shell -E 'with import<nixpkgs>{};clangStdenv.mkDerivation{name="name";hardeningDisable=["all"];buildInputs=[ccache cmake fish file gdb libedit libxml2 ncurses ninja python27 ripgrep swig which];}' --run fish

eddyb (Apr 26 2019 at 06:55, on Zulip):

this is what I use

eddyb (Apr 26 2019 at 06:55, on Zulip):

this allows building even lldb

eddyb (Apr 26 2019 at 06:56, on Zulip):

the -E string you can put in a default.nix file, if you want it to be nicer than my lazy setup

eddyb (Apr 26 2019 at 06:56, on Zulip):

whoa, I didn't realize pkgs.mkShell was a thing o_O

eddyb (Apr 26 2019 at 06:58, on Zulip):

oh yeah and my variant builds LLVM with clang, specifically

eddyb (Apr 26 2019 at 06:58, on Zulip):

I don't think I managed to ever get GCC to work, lol

eddyb (Apr 26 2019 at 06:58, on Zulip):

the LD_LIBRARY_PATH problem is not specific to NixOS AFAIK

eddyb (Apr 26 2019 at 06:59, on Zulip):

@davidtwco you can install rustup, which 1. does automatic patching of downloaded binaries for you 2. works great for using a locally-built toolchain

davidtwco (Apr 26 2019 at 07:02, on Zulip):

I never bothered to set up using rustup toolchains for my local builds, maybe I should.

eddyb (Apr 26 2019 at 07:02, on Zulip):

yeah it's trivial nowadays :D

eddyb (Apr 26 2019 at 07:02, on Zulip):

nix-env -i rustup followed by rustup toolchain link rust-1-stage1 /home/eddy/Projects/rust-1/build/x86_64-unknown-linux-gnu/stage1

davidtwco (Apr 26 2019 at 07:03, on Zulip):

oh yeah and my variant builds LLVM with clang, specifically

I’ve been experimenting with this recently and had to go through a lot of effort to make the clang that was built could find the standard library headers (since the locally built clang wouldn’t have been wrapped).

davidtwco (Apr 26 2019 at 07:04, on Zulip):

What does NIX_AFFINITY_HACK do?

davidtwco (Apr 26 2019 at 07:06, on Zulip):

I’ve also been having a single spurious run-pass failure (I forget the test name off-hand) since switching my build server to NixOS. I’ve been able to safely ignore it so far since none of my changes have affected that test. It fails with a stack overflow I believe.

eddyb (Apr 26 2019 at 07:06, on Zulip):

I have no failures over here

eddyb (Apr 26 2019 at 07:06, on Zulip):

it could be an ulimit thing

eddyb (Apr 26 2019 at 07:06, on Zulip):

NIX_AFFINITY_HACK... works around... something

eddyb (Apr 26 2019 at 07:07, on Zulip):

https://github.com/NixOS/nix/issues/2359

eddyb (Apr 26 2019 at 07:07, on Zulip):

oh

eddyb (Apr 26 2019 at 07:07, on Zulip):

can I just remove it?

eddyb (Apr 26 2019 at 07:07, on Zulip):

I'm not using nix run lol

davidtwco (Apr 26 2019 at 07:09, on Zulip):

I’ve been using lorri instead of nix-shell because that integrates with direnv and lets me avoid needing to manually add zsh to the shell.nix but also makes the project a gc root so I can run the garbage collection regularly without worrying about removing my development environment packages if I ever need to work offline and can’t download them.

davidtwco (Apr 26 2019 at 07:09, on Zulip):

I wasn’t aware of nix run.

davidtwco (Apr 26 2019 at 07:09, on Zulip):

lorri is written in Rust which is also nice.

Alexey Shmalko (Apr 26 2019 at 22:18, on Zulip):

@eddyb I think you don't need SSL_CERT_FILE hack either.
https://github.com/NixOS/nixpkgs/issues/13744

eddyb (Apr 27 2019 at 13:00, on Zulip):

huh

eddyb (Apr 27 2019 at 13:00, on Zulip):

I can try removing it, I guess

eddyb (Apr 27 2019 at 13:01, on Zulip):

that would make it possible to use mostly just a default.nix with nix-shell

Last update: Nov 22 2019 at 00:25UTC