[Nix-dev] how to use platform tools (gcc, libc) with nix ?

Pierre Bourgin pierre.bourgin at arteris.com
Fri Nov 16 09:48:26 CET 2007


Hello,

I'm currently evaluating nix (0.11) as a package management that could 
help to manage third party tools along the system on RHEL/CentOS linux 
distribution (3, 4, 5).

Of course Nix seems to be a good candidate, thanks to its numerous
lovely features !
One of the most interesting one (for me) is the ability to store 
numerous binary packages of different versions all along (and their 
dependancies), so any of them remain easily available.

Contrary the nix purity philosophy, I would like to use a lot of 
tools/libs provided by my Linux distribution, instead of relying only on 
nix packages (and thus rebuild a complete system in the nix world).
I would like also to keep the ability to easily switch from a platform 
tool onto a nix packaged one.
Example:
   . use libc from the platform (always)
   . use gcc from the platform (/usr/bin/gcc)
   . use a newer gcc than /usr/bin/gcc : use a nix package

I've began to read file pkgs/top-level/all-packages.nix and files 
related to stdenv, but I can't figure out how to reach this goal.

In my mind, the most lazy way to do this will be to create 
my-packages.nix with a code like:
  import ./pkgs/top-level/all-packages.nix
then modify some attributes (or redefine them), in order to use the libc 
or gcc from the platform for instance.

By this way, I will "benefit" from all the features/dependancies already 
written in all-packages.nix, instead of trying to rewrite it from 
scratch (and have a worth version).

But ./pkgs/top-level/all-packages.nix have only few attributes/variables 
in its interface for a derivation, no ?

And even if I write my-packages.nix from scratch (inspired from 
all-packages.nix content), I think to have troubles with stdenv nix 
files related to linux platform, since it's code tend to consider that 
this platform absolutely needs a gcc nix package for instance, no ?
Contrary to the Darwin platform, where nix uses the native compiler.

Do you think I will be obliged to redefine the "core" options for the 
linux platform or create a new platform (like "my-linux") that 
superseeds the provided linux platform in stdenv ?

Thanks in advance for your comments.
If you have any advices or clue, don't hesitate ;-)

And sorry for my english, that is not better than my nix skills (at 
least right now ;-)

Pierre Bourgin



More information about the nix-dev mailing list