[Nix-dev] Help creating a custom app with Nix package manager

Alex Berg chexxor at gmail.com
Fri Feb 28 16:36:29 CET 2014


Yo Asus, you're a bit slow receiving a response from the list for this
issue. Apologies!

That error message - "cannot auto-call a function..." - this occurs when
when you call a Nix function but don't supply a requested value.

Here's [1] a page on the NixOS wiki where I'm trying to gather common error
messages. This one is on that list.
That page links to this [2] older email thread from someone with a similar
issue.

In Nix, functions can take "named arguments". Here's a page [3] which
describes this concept implemented in C#.

In your case, your package's function signature includes a whole set of
arguments

         { stdenv, fetchurl, pkgconfig, libsoup, webkit, gtk,
glib_networking, gsettings_desktop_schemas, makeWrapper  }:

Here's where to wiggle the code to fix it. If you want to call this
function, a value must be specified for each parameter.

        luakit = callPackage ../applications/networking/browsers/luakit {
             inherit stdenv; # Add some more arguments here. Check other
packages for examples.
             inherit (gnome) libsoup;
             webkit = webkit_gtk2;
         };

Now, IIRC, the `callPackage` function should resolve most of these
arguments automatically, so we shouldn't need to give `stdenv` a value. So,
this is why I can't give you an exact solution. Take a bit to read the
source code a bit, here [4], and read backwards to see how that is
implemented. Hopefully there's some comments.

Apologies for my laziness to completely solve the problem for you!


[1] https://nixos.org/wiki/Error_Messages
[2] http://lists.science.uu.nl/pipermail/nix-dev/2009-July/002671.html
[3] http://msdn.microsoft.com/en-us/library/dd264739.aspx
[4]
https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L146


On Thu, Feb 27, 2014 at 8:30 AM, Asus Ceaser <theprepboys at gmail.com> wrote:

> I did a fresh install and started following the Nixpkgs manual to
> create a custom package.  I want to use the web browser luakit.
>
> So I cloned the git repository and changed directory into it.
>
> I then created the directory luakit under
> /pkgs/applications/network/browsers/
>
> I created a default.nix which looks like this:
>
>  { stdenv, fetchurl, pkgconfig, libsoup, webkit, gtk, glib_networking,
> gsettings_desktop_schemas, makeWrapper  }:
>
>
>
>    stdenv.mkDerivation rec {
>
>      name = "luakit-${version}";
>
>      version = "2012";
>
>
>
>      src = fetchurl {
>
>        url = "
> https://github.com/mason-larobina/luakit/archive/${version}.tar.gz";
>
>        sha256 = "...";
>
>      };
>
>
>      buildInputs = [ makeWrapper gtk libsoup pkgconfig webkit ];
>
>
>
>      makeFlags = [ "PREFIX=$(out)" ];
>
>
>
>      postInstall = ''
>
>        wrapProgram "$out/bin/luakit" \
>
>          --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules"
> \
>
>          --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share"
>
>      '';
>
>
>
>      meta = {
>
>        description = "A Vim-like browser";
>
>        longDescription = ''
>
>          A fast and lightweight vim like web browser based on the webkit
> web
>          browser engine and the lua toolkit. luakit is keyboard driven
> and can be extended through the use of lua code.
>
>       '';
>
>       homepage = "http://www.luakit.org";
>
>       license = stdenv.lib.licenses.gpl3;
>
>       maintainers = [ stdenv.lib.maintainers.rickynils ];
>
>       platforms = with stdenv.lib.platforms; linux;
>
>     };
>
>   }
>
> I then edited pkgs/top-level/all-packages.nix and it looks like this:
>
>
>  luakit = callPackage ../applications/networking/browsers/luakit {
>      inherit (gnome) libsoup;
>      webkit = webkit_gtk2;
>  };
>
>
> I then ran the command nix-build -A luakit
>
> and I get the error error: cannot auto-call a function that has an
> argument without a default value (`stdenv')
>
>
> I am not new to Linux but new to this type of package development.  I
> did read the other emails and posts made by others who have had this
> same problem as me, but I when I tried to do as they do I still got
> the message.  If someone could help a noob I would appreciate it.
>
> ~Thank you
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140228/78ec68ca/attachment.html 


More information about the nix-dev mailing list