On Sat, 03 Dec 2011 23:43:14 -0700, Иван Левашев <octag...@bluebottle.com> wrote:
> Hello! > > I'm running in circles. I can't install a self-written derivation that I > haven't written into all-packages.nix. Manual only has samples where a > package is present in all-packages.nix. I don't want to touch this file > yet. Ivan, One trick that I use is that your $HOME/.nix-defexpr will be scanned for .nix files. It may be possible to put your rhash expression file there directly, but the setup I use is to have a $HOME/my_nixexprs directory with a subdirectory for each local package+nix expression file I want, and a $HOME/my_nixexprs/default.nix that acts similarly to all-packages.nix and is invoked by a local.nix file in my $HOME/.nix-defexpr. For example: $ cat $HOME/.nix-defexpr/local/nix: {}: let toplevel = import /etc/nixos/nixpkgs/pkgs/top-level/all-packages.nix{}; empkgs = toplevel.emacsPackages { emacs = toplevel.emacs; }; evempkgs = empkgs { self = toplevel; }; haskellMode = evempkgs.haskellMode; getEnv = x: if builtins ? getEnv then builtins.getEnv x else ""; homeDir = getEnv "HOME"; myNix = homeDir + "/my_nixexprs"; in import myNix { inherit toplevel; } $ Note here that I have a couple of local definitions for various environments or settings from all-packages.nix that I may need in my local expressions. You may need to update this periodically and as appropriate for your needs. $ cat $HOME/my_nixexprs/default.nix { toplevel }: let empkgs = toplevel.emacsPackages { emacs = toplevel.emacs; }; in rec { haskellmodedarcs = import ./haskell-mode-darcs { inherit (toplevel) stdenv fetchurl fetchdarcs emacs; inherit empkgs; }; smg = import ./smg { inherit (toplevel) fetchurl python buildPythonPackage; }; pylibpcap = import ./pylibpcap { inherit (toplevel) fetchurl python stdenv libpcap; }; # Done. Requires autoconf/automake though which causes lots of needed updates. # Better to just use configureFlags for overrides? lnav = import ./lnav { inherit (toplevel) zlib stdenv fetchurl ncurses; inherit (toplevel) pcre readline sqlite binutils; autoconf = toplevel.autoconf; automake = toplevel.automake110x; }; trowser = import ./trowser { inherit (toplevel) stdenv fetchurl tcl tk; }; } $ The above default.nix functions as my local all-packages.nix and I add or remove packages (local subdirectories) as they are ready or retired. This default.nix (plus my local.nix) provide all the tweaking so that the nix expression for the local packages is not aware that is it not part of the /etc/nixos/nixpkgs/ tree. $ cat $HOME/my_nixexprs/pylibpcap/default.nix {stdenv, fetchurl, python, libpcap}: let version="0.6.2"; in stdenv.mkDerivation rec { name = "pylibpcap-" + version; src = fetchurl { url = "mirror://sourceforge/pylibpcap/${name}.tar.gz"; sha256 = "0cdb507eaf27e7d6f4e3ee74a5986e14728fd8161785350d201a12198c19fcc6"; }; buildInputs = [python libpcap]; buildPhase = "python ./setup.py build"; installPhase = '' python ./setup.py install --prefix="$out" || exit 1 ''; meta = { description = "Python module for the libpcap packet capture library"; homepage = http://pylibpcap.sourceforge.net/; }; } $ Hope this helps and that it's not too far from normal Nix practices. -- -KQ _______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev