Re: [Nix-dev] (newbie) nix-env custom package installation

2011-12-04 Thread Lluís Batlle i Rossell
On Sun, Dec 04, 2011 at 01:43:14PM +0700, Иван Левашев 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.

Hello!

Well, your file needs stdenv,fetchurl,openssl from nixpkgs. So, first, your
expression should include nixpkgs for those:

Keeping your rhash.nix:


nix-env -E 'let pkgs = import /etc/nixos/nixpkgs; in { rhash = import 
./rhash.nix {
inherit (pkgs) stdenv fetchurl openssl}; }' -i rhash

I don't know if it does work. But do you get the idea?

Regards,
Lluís.

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] (newbie) nix-env custom package installation

2011-12-04 Thread Marc Weber
Excerpts from Иван Левашев's message of Sun Dec 04 07:43:14 +0100 2011:
 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.
That's the way to go: use packageOverrides:
https://nixos.org/wiki/Howto_keep_multiple_packages_up_to_date_at_once

Keeping changes to nixpkgs is fine as well - for a limited time.
If you want to keep patches longer you have to create your own branches
(using SVN asking for access) - or by using git/mercurial/... mirrors.
I maintain git mirrors for nixos/nixpkgs. Thus forking and keeping local
changes is cheap. Contact me on irc (MarcWeber) if you want more details
about the git way and write again if the wiki page above does not show
what you're looking for.

Marc Weber
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] (newbie) nix-env custom package installation

2011-12-04 Thread Kevin Quick
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


[Nix-dev] (newbie) nix-env custom package installation

2011-12-03 Thread Иван Левашев
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.

So I have written rhash.nix:

{stdenv, fetchurl, openssl ? null}:

let
   version = 1.2.8;
in
stdenv.mkDerivation {
   name = rhash-${version};
   inherit openssl;

   makeFlags = if openssl != null then ADDCFLAGS=\-DUSE_OPENSSL 
-DOPENSSL_RUNTIME -rdynamic\ ADDLDFLAGS=\-ldl\ else ;
   src = fetchurl {
 url = 
mirror://sourceforge/rhash/${version}/rhash-${version}-src.tar.gz;
 md5 = 6b9db38cc322caa5cd0151abdc92a2b5;
   };

   buildinputs = if openssl != null then [openssl] else [];

   meta = {
 homepage = http://rhash.anz.ru/?l=en;;
 description = RHash (Recursive Hasher) is a console utility for 
computing and verifying hash sums of files;
   };
}


Now I'm trying to guess how to install it.

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = import ./rhash.nix;}' 
-i rhash--dry-run
(dry run; not doing anything)
error: cannot auto-call a function that has an argument without a 
default value (`stdenv')

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = callPackage ./rhash.nix 
{ stdenv = f.stdenv; fetchurl = f.fetchurl; openssl = f.openssl; } ;}' 
-i rhash --dry-run
(dry run; not doing anything)
error: undefined variable `callPackage', in `(string)'

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = f.callPackage 
./rhash.nix { stdenv = f.stdenv; fetchurl = f.fetchurl; openssl = 
f.openssl; } ;}' -i rhash --dry-run
(dry run; not doing anything)
error: attribute `callPackage' missing

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = import ./rhash.nix { 
stdenv = f.stdenv; fetchurl = f.fetchurl; openssl = f.openssl; } ;}' -i 
rhash --dry-run
(dry run; not doing anything)
error: attribute `stdenv' missing
(use `--show-trace' to show detailed location information)

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = import ./rhash.nix f 
;}' -i rhash --dry-run   (dry run; not doing anything)
error: function at `/home/OCTAGRAM/rhash.nix:1:1' called without 
required argument `stdenv'

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = import ./rhash.nix f {} 
;}' -i rhash --dry-run
(dry run; not doing anything)
error: function at `/home/OCTAGRAM/rhash.nix:1:1' called without 
required argument `stdenv'

[OCTAGRAM@nixos:~]$ nix-env -E 'f: f // {rhash = import ./rhash.nix (f 
{}) ;}' -i rhash --dry-run
(dry run; not doing anything)
error: attempt to call something which is neither a function nor a 
primop (built-in operation) but an attribute set

I believe it to be indeed possible, but I've ran out of ideas. IIUC I 
must construct something similar to what is defined in all-packages.nix, 
but all-packages is too long, I can't easily overlook it.

If that means something, I have NixOS installed inside VMWare Server 
(it's free, BTW).

Best regards,
Ivan Levashew

-- 
If you want to get to the top, you have to start at the bottom

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


[Nix-dev] (newbie) nix-env custom package installation

2011-12-03 Thread Michael Raskin
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.

most simple cases are handled by my script 
/etc/nixos/nixpkgs/maintainers/scripts/nix-call-package

So I have written rhash.nix:

{stdenv, fetchurl, openssl ? null}:


Yup, arguments seem to be auto-findable


If that means something, I have NixOS installed inside VMWare Server 
(it's free, BTW).

Currently free of charge, you mean? Yes, I guess most people here knows.



___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev