nix
nix copied to clipboard
It's unclear what nix eval --arg and --argstr do
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
- [x] checked latest Nix manual (source)
- [x] checked open documentation issues and pull requests for possible duplicates
Proposal
Figure out and clarify what --argstr actually does with nix eval.