nix icon indicating copy to clipboard operation
nix copied to clipboard

It's unclear what nix eval --arg and --argstr do

Open lf- opened this issue 3 years ago • 0 comments

Problem

I want to run builtins.compareVersions from the command line with argument strings. However, I can't figure out how to actually do that.

I've tried nix eval --raw --argstr a 1.23 --argstr b 1.24 --expr '{a, b}: builtins.compareVersions a b', which returns this:

nix eval --raw --argstr a 1.23 --argstr b 1.24 --expr '{a, b}: builtins.compareVersions a b'
error: cannot coerce a function to a string

--apply seems promising but it maps over the installable paths, which is not really what I want. I just want to call a nix function with arguments from the shell. It's unclear to me what --argstr actually does given this.

Checklist

Proposal

Figure out and clarify what --argstr actually does with nix eval.

lf- avatar Sep 21 '22 19:09 lf-