Add option to abort if installation requires compilation.
Nix-env has the option -b which stops an install at the point where code would need to be compiled. This helps to prevent the machine going into a long compile process that is hard to interrupt.
I didn't know about "-b". It seems to be a great way to update the packages that doesn't fail when some can't be build.
Its behavior seems to just ignore what cannot be built, so I'll have to couple it with a call to "nix-env -qsa" (before or after") to know whether the package was actually installed or not.
Anyway, it is indeed something that we want.
@vandenoever Correct me if I'm wrong, but "nix-env -b" not only does not compile, but also does not download, meaning it will only install if the derivations already are in the nix store. That's not exactly what we want, is it?
@madjar, -b does imply downloading. man nix-env says:
--prebuild-only / -b
Use only derivations for which a substitute is registered, i.e.,
there is a pre-built binary available that can be downloaded in
lieu of building the derivation. Thus, no packages will be built
from source.
@vandenoever That is not the behaviour I observe:
> nix-env -i gdb --dry-run
(dry run; not doing anything)
installing `gdb-7.8'
these paths will be fetched (0.00 MiB download, 58.79 MiB unpacked):
/nix/store/2rv6ya6sdkbfmpsrclzpknyl7myfpkqy-python-2.7.8
/nix/store/xxw6x4kspjwc2cbjpsjw4maf063mz2q3-gdb-7.8
> nix-env -i gdb -b --dry-run
(dry run; not doing anything)
So it seems the documentation does not match the implementation. Could you confirm this?
With --dry-run it will not download anything, but without --dry-run, it will.
nix-env -i gdb -b does absolutely nothing. Could you try to reproduce those results on your side?
If it does not do anything, that means that there is no binary available. If you look at your network traffic, you'll see that nix-env tries to contact hydra to get binaries.
@vandenoever my bad, gdb was a bad example. I still don't understand why nix-env -i gdb --dry-run is only about fetching, not building, and and -b won't work.
Anyway, thanks for the answers.