News for hackers. Stuff that matters.
Re:Nix as OS X Package Manager by bydo on Wednesday May 25, 2016 @05:03PM (#11773066)
On that note, is there some valid reason Nix absolutely needs access to / to create /nix? Why can't it live somewhere else? I believe some parts can go anywhere, but /nix is hard coded for the rest, which I'm not entirely comfortable with.
Re:Nix as OS X Package Manager by pmahoney on Wednesday May 25, 2016 @05:15PM (#11773179)
The pre-built binary packages available from the Nix project are all compiled for /nix; this choice is baked in to the binaries, which refer to shared libs via absolute paths for example.

I understand this path is configurable, but you'll be compiling everything yourself, unable to use Nix's binary cache. You also risk running into unique problems since everyone else is using /nix

Re:Nix as OS X Package Manager by mitchty on Wednesday May 25, 2016 @05:22PM (#11773232)
Yep, additionally, /nix is really no different than /usr/local here. Just in a different spot.

I'd recommend everyone try nixos out as well to see why everything (mostly) in /nix is a good idea.

nixos is easily the most un unix unix i've seen, and honestly i can't wait to get rid of apt/rpm/yum/zypper. Not dealing with /some/file/blah being version X or Y in general is so freeing.

Re:Nix as OS X Package Manager by hk__2 on Wednesday May 25, 2016 @06:03PM (#11773499)
> I understand this path is configurable, but you'll be compiling everything yourself, unable to use Nix's binary cache

Not necessarily. Homebrew compiles stuff for a special prefix then substitutes your own prefix when you install the binary. It doesn’t work with everything (that’s why some compiled packages are available for /usr/local only) but it’s a start.

Re:Nix as OS X Package Manager by cstrahan on Wednesday May 25, 2016 @06:55PM (#11773827)
Nix uses rpaths on Linux (install names on OSX) to fix the precise location of dynamically linked dependencies, and it also patches the paths to executables (e.g. In string laterals or shebangs) needed at run time. To change the location of a binary, one would have to patch the dependents so that /nix/store is replaced with the new prefix, which is generally not possible to do, unless the new prefix has the same length as the old prefix - in which case you can just sed every file.

Homebrew just assumes that the needed executables will be available on $PATH and that the dynamic linker will find libs in /usr/lib or /usr/local/lib.

So yes, you really would need to recompile everything if change the prefix from /nix/store to something else.

Edits: fixed spelling and structure from originally typing via phone.

Re:Nix as OS X Package Manager by vertex-four on Wednesday May 25, 2016 @05:11PM (#11773133)
All Nix packages are built with full-path references to other packages in Nix - if you move it elsewhere, the result is that you can't use the binary cache built by Hydra, and you have to build everything from source.
Re:Nix as OS X Package Manager by hso1 on Wednesday May 25, 2016 @05:09PM (#11773120)
I don't know for sure, but I think it's installed under /nix thinking of multi-user Nix installs. With Nix any system user can install its own set of packages and on NixOS there are build users that install packages on behalf of normal users.