Hi. I have an issue regarding the combination of two Nix features:
default parameters ( f = {arg ? def } : ...) and arbitrary length
parameters (f = args@{arg, ...} : ...). It looks like they doesn't
work together silently. Here is the example from my code. I'd like the
function make-nk-parser to tweak some of it's arguments and pass them
downstream to the makeHaskell function. In particular, I want it to
add 'nk' to the list of dependencies or make it the only dependency.


    make-nk-parser = args@{buildDepends ? [], ...} :
        makeHaskell (args // {
            pname = "nk-parser";
            buildDepends = args.buildDepends ++ [nk];
            isExecutable = true;
        });

Unfortunately, this code doesn't work. I call make-nk-parser with
empty arguments and Nix errors with "error: attribute ‘buildDepends’
missing" near the args.buildDepends. In contrast, the following
workaround works:

    make-nk-parser = args@{...} :
        let
            buildDepends = if args ? buildDepends then
args.buildDepends else [];
        in
        makeHaskell (args // {
            pname = "nk-parser";
            buildDepends = buildDepends ++ [nk];
            isExecutable = true;
        });

Is it a known bug or feature?

Regards,
Sergey
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to