[Nix-dev] Bundling nix-expressions with source code

Rickard Nilsson rickard.nilsson at telia.com
Thu Jan 24 16:13:00 CET 2013


Den 2013-01-22 14:51:24 skrev Eelco Dolstra <eelco.dolstra at logicblox.com>:

> Hi,
>
> On 22/01/13 13:05, Rickard Nilsson wrote:
>
>> I would like to bundle nix-expressions with some of my self-developed
>> programs, and just let nixpkgs (or some custom-nixpkgs) use the
>> nix-expression from the source when building the program. Is this a wise
>> thing to do? Is it even possible?
>
> It's possible but unfortunately not a good idea.  Doing this:
>
>>    myprog_src = fetchgit { ... };
>>
>>    myprog = callPackage "${myprog_src}/default.nix" { };
>
> in Nixpkgs means that an operation like "nix-env -qa '*'" will need to  
> build
> myprog_src first, which won't work because query operations open the Nix  
> store
> in read-only mode.

OK, I see why that is not feasible. The reason I ask, is that it seems
reasonable that a Nix-aware upstream package developer should be able
to define how the package should be built (dependencies, build flags etc),
in tandem with the package development itself.

I imagine that you in some way could define package names, versions,
source url, source checksum and other metadata in nixpkgs, and then
pick buildInputs, configureFlags etc from the source. But that is
more or less what we do today anyway, with the difference that we
pick a configure-script and a Makefile from the source instead of
Nix-expressions.


Best regards,
   Rickard Nilsson


More information about the nix-dev mailing list