On 2018-07-17 5:10 PM, Brett Viren wrote:
>
rpta...@computecanada.ca writes:
>
>> "Nix is beautifully consistent as long as you stick with only Nix. As
>> soon as you build things outside of Nix (install and compile Python,
>> Perl or R packages for example), it is going to link to the Nix store
>> in a way that Nix is unaware of, and the next Nix garbage collection
>> is going to break all those things.
> Nix GC is evoked manually. If I build against stuff against /usr/local
> and then do "rm -r /usr/local", same breakage will happen.
Yes, except that you don't have a gazillion different versions of
/usr/local (like you would with Nix), and that GC is not supposed to
break anything that is used (that's the definition of GC, it deletes
*garbage*). It works correctly for anything that is installed with Nix.
The problem is that Nix has no way to know what's garbage and what is
not if *anything* is built outside of Nix (and users do that all the time).
So, basically, this means that if :
- you expose Nix to users
- you let the Nix compiler link against the nix store
then you cannot run garbage collection *ever* without risking breaking
some of your users jobs. That means you also cannot apply security fixes
or patches to fix something that's broken.
To prevent that, the way we work with our stack is that we expose a
single Nix profile to our users, and we modified the linker wrapper so
that any linking that is done outside of Nix itself is done through that
one profile, not through the nix store.
We are currently sitting at 53k different directories in our nix store
on our build-node, many of which are old versions of packages that have
since then been upgraded. On our deployed stack, we only have 5k. So,
more than 90% of the stuff we ever built is Nix is no longer used.
>> Going this way is a catastrophe
>> waiting to happen on a HPC cluster environment with end users. We had
>> to backtrack a few packages that were installed in Nix (Python, Perl,
>> Qt) and compile them with EasyBuild rather than Nix because we ran
>> into such problems."
> If the high level packages are built with Nix then I don't see how the
> Nix GC would remove their dependencies while still keeping them around
> broken.
virtualenv copies "python" from Nix into the user's directory. It is
hard-coded to look for paths in the nix store. The user then installs
python packages with pip. Even if the user is aware of Nix, he could
install a virtualenv with Python 2, and then install Python 3 in its own
profile, or install a new version of Python 2. Nix has no idea about the
external virtual environment. If garbage collection is run, it will
delete the old seemingly unused python with its libraries... and break
the virtual environment.
Perl will do the same too. If you call perl or cpan to install packages
in your home folder and they were install with Nix, the installed
package will be full of paths to the nix store, which if GC'ed will then
break the installed package.
Another problem that we ran into is that Nix tends to split many
packages (such as Qt) into multiple installation directories. Again, Nix
itself is self-coherent, but the rest of the world is typically not
Nix-aware and will likely make assumption such as "all Qt libraries are
installed in the same directory as qmake".
Maxime