[Nix-dev] Howto add custom packages ?

Eelco Dolstra eelco at cs.uu.nl
Mon Apr 16 14:24:37 CEST 2007


Hi,

Marc Weber wrote:
> What is the recommended way to add some custom packages nobody else will
> ever use?

There are basically two ways.

You can do a checkout of Nixpkgs and add your own stuff to it.  Of course, then
you have to deal with merge conflicts when you do an update.

The alternative is to keep your custom Nix expressions outside of the Nixpkgs
tree and import all-packages.nix from your Nix expression.  E.g.

=====
let

  pkgs = import /path/to/all-packages.nix { };

  # you can also pass a specific platform, like
  pkgs = import /path/to/all-packages.nix { system = "i686-freebsd"; };

in

pkgs.stdenv.mkDerivation {
  name = "mypackage";
  ...
  buildInputs = [pkgs.somepkg];
  ...
}
=====

This is what we do in NixOS and in the Nix expressions for our web services.

-- 
Eelco Dolstra | http://www.cs.uu.nl/~eelco



More information about the nix-dev mailing list