[Nix-dev] Bundling nix-expressions with source code
Eelco Dolstra
eelco.dolstra at logicblox.com
Tue Jan 22 14:51:24 CET 2013
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.
OTOH, if you just want to use Nixpkgs inside another project, like Marc said,
you can just do something like:
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "my-pkg";
src = ./.;
buildInputs = [ qt4 ... ];
};
> Obviously, the above example does not work.
It actually does work in some cases, e.g. "nix-build -A myprog" should work.
--
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
More information about the nix-dev
mailing list