[Nix-dev] Generating nix expression vs. ad-hoc generation of derivations (was: Re: [Nix-commits] [NixOS/nixpkgs] c6a2a1: ffmpeg: Update to latest version 0.11.1.)

Florian Friesdorf flo at chaoflow.net
Tue Jul 24 20:10:51 CEST 2012


On Tue, 24 Jul 2012 19:40:27 +0200, Vladimír Čunát <vcunat at gmail.com> wrote:
> On 24 July 2012 19:20, Florian Friesdorf <flo at chaoflow.net> wrote:
> > I understand the wish for having it in one expression and keep
> > duplication low. But I think the expressions should be as simple as
> > possible and, as Eelco says, with the possibility to change them
> > independently.
> 
> Well, OK, it seems to be the major opinion here, so I'm going to
> respect it when writing expressions.
> 
> 
> > I think generating expressions is a better solution to target
> > duplication than having expressions deal with different versions. This
> > is already done for at least xorg and haskellPackages.
> 
> But that is exactly what I do... you supply a version and an
> expression for the version is returned.
> 
> If we could generate dependencies and options from standard build
> systems like autotools, cmake, ... that would really be great. Perhaps
> with some amendments because of broken packages, but still it would
> save so much code

If I understand correctly you want / are doing something like this:

There is a nix expression that when called returns a nix derivation for
a specific version of ffmpeg. I would call this ad-hoc generation of
derivations using the nix language. I might be mistaken, but I think
in a way this is similar to the approach Marc is using in his overlays
[1].

A recurring discussion seems to be whether derivations should be
generated on the fly like this or whether there should be nix
expressions in nixpkgs that have a one-to-one correspondance to
derivations.

These expressions can also be generated, but that happens prior and
independent to running nix, in whatever language desired.

I see the following advantages:

- generated expressions look very similar to manually created ones
  making it much easier to understand what is going on

- no knowledge needed of the tools used to create the expressions.
  Instead it is easily possible to change an expression if needed and
  those knowing the tools can integrate the changes into the tools
  generating the expressions. AFAIK done like that by Peter and Andres
  for haskellPackages.

- magic, like dependency-resolution, is done outside of nix, keeping the
  complexity of nix and nixpkgs low.

It feels that if we are able to generate derivations, we should do so,
but put them into files (nixpkgs) and use these files as the interface
between nix and the algorithms that help us to generate the derivations.


1. arbitrary source (hackage, pypi, marmalade, different ffmpeg versions)

2. magic tools (sharing code) to generate expression that declare
   derivations, in contrast to generating them

3. nixpkgs

4. nix/nixos tools to install these package

What do you not like about this approach and in what way do you think
generating derivations on the fly is better?

regards
florian

[1] http://nixos.org/wiki/Nix(OS)_related_repositories_and_work
-- 
Florian Friesdorf <flo at chaoflow.net>
  GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083
Jabber/XMPP: flo at chaoflow.net
IRC: chaoflow on freenode,ircnet,blafasel,OFTC
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20120724/f1ff4ae3/attachment-0001.bin 


More information about the nix-dev mailing list