[Nix-dev] Nix as a build script for developers
Nicolas Pierron
nicolas.b.pierron at gmail.com
Sun Oct 25 02:32:56 CEST 2009
Hi Sam,
On Sun, Oct 25, 2009 at 01:40, Sam Thursfield <ssssam at gmail.com> wrote:
> Since Nix can build packages from source, does anyone think it would
> be neat to use it as a replacement for complex build scripts, like
> GNOME's jhbuild?
Sounds interesting.
> Nix would need a few obvious extra features:
> - svn/git/cvs in addition to fetchurl
AFAIK, Nix already have fetchcvs, fetchsvn and fetchgit.
> - a way of specifying both a VC repo and tarball locations for a
> module in the same file
Unfortunately, if you want to have the same hash for both, the tarball
should be created by a subversion checkout. Then the tarball can be
downloaded as the binary version can be downloaded instead of the
sources.
If you don't need to have the same hash (implies rebuilding everything
depending on it when switching to the other), then this is just the
matter of a boolean flag or a default value.
> - and a way for the user to specify what version of the module they
> want installing.
Currently, we try to avoid multiple versions inside NixPkgs, the
reason is that we are not an extreme number of developers to maintain
multiple versions of a derivation (= jhbuild module). Nonetheless,
the feature exists and is used for some programs which are moving
slowly or which are not backward compatible. (see selectVersion in
NixPkgs)
> - the ability to maintain and build modules from directories in the
> user's search tree, so they could hack on them and then install them
We already have such thing. All projects compiled by the buildfarm (
http://hydra.nixos.org ) have a release.nix file at the root of their
repository. This file is use by the buildfarm, to compile the
project, and it can be used by the developer bto compile the app from
the sources by running "" $ nix-build ./release.nix -A derivationName
-o linkToInstallDir "". These release.nix files can have a default
path which is looking at other checkout locations to build the current
derivation (= jhbuild module) with other derivation located on
siblings directories (or based on some environment variables to locate
them).
> - a way to make the built code more permanent (could put it in a
> build/ directory in the source tree or just in the
> source tree, as per taste)
When you are building with Nix, it does the following:
- copy your sources to a sane environment.
- build inside the copied directory.
- generate an install directory.
What you are talking about is VBUILD_PATH, These feature is entirely
orthogonal to Nix, This kind of variations is defined inside the
builder of the derivation, which builds inside the sources by default.
> - more vicious garbage collection, since there would be lots more new
> versions being installed
I don't get your point? I've a Nix store which is almost 40 GB, which
is ridiculous compare to what the buildfarm has, and we do not have
bad garbage collection experiences. (except once among ???, I've heard
of it on the irc channel)
> - and probably other things .. (including stuff like interactive error
> handling to make the whole thing a bit more
> friendly as a build script)
I recommend you to have a look at hydra.nixos.org.
>
> Anyway, this seems like a fair amount of work and jhbuild does the job
> fairly well, so I'm not going to cancel my weekend to start work on
> this. I'd really just like to hear from knowledgeable people on
> whether they think this is an interesting possibility or whether I am
> totally on crack ..
I don't think so. All features you have described are already coded
and used. So may be you should get a bit more familiar with Nix, and
try to setup a buildfarm for some of your projects.
--
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
Donald Knuth - I can't go to a restaurant because I keep looking at
the fonts on the menu.
More information about the nix-dev
mailing list