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

Rickard Nilsson rickard.nilsson at telia.com
Tue Jan 22 13:05:09 CET 2013


Hi,

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?

A pseudo-example:


nixpkgs:
...

   myprog_src = fetchgit { ... };

   myprog = callPackage "${myprog_src}/default.nix" { };

...


default.nix:

{ stdenv, foo, bar }:

stdenv.mkDerivation = {
   src = ./;
   buildInputs = [ foo bar ];
}


Obviously, the above example does not work. But can something similar,  
that actually works, be written in nix? Or must one always separate the  
package definition (nix mkDerivation expression) and the source?


Best regards,
   Rickard Nilsson


More information about the nix-dev mailing list