[Nix-dev] error: cannot auto-call a function that has an argument without a default value (‘stdenv’)

Vladimír Čunát vcunat at gmail.com
Fri Jul 7 08:07:34 CEST 2017


On 07/06/2017 05:54 PM, tj5527 via nix-dev wrote:
> Following the example
> at http://nixos.org/nix/manual/#chap-writing-nix-expressions to build
> hello package. But `nix-build -A hello` throws error "error: cannot
> auto-call a function that has an argument without a default value
> (‘stdenv’)"
> 
> How can I fix this problem?

Well, apparently you try to evaluate a standalone file that specifies a
function but you don't specify how to fill its parameters.  It should be
explained in the following section
http://nixos.org/nix/manual/#sec-arguments

That's how it's commonly done in nixpkgs.  If you want a *separate*
expression that depends on nixpkgs, you may e.g. start by adding this
line to the beginning of the file:
    with import <nixpkgs> {};
instead of
    { stdenv, something1, something2, ... }:

--Vladimir


More information about the nix-dev mailing list