You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ time nix eval --expr 'builtins.compareVersions "1.0.0" "2.0.0"'
nix eval --expr 'builtins.compareVersions "1.0.0" "2.0.0"' 0.01s user 0.01s system 99% cpu 0.017 total
$ time bash -c "echo '1.0.0' '2.0.0' | sort -C -V"
bash -c "echo '1.0.0' '2.0.0' | sort -C -V" 0.00s user 0.00s system 96% cpu 0.006 total
I'm not particularly worried about this in the general sense. I happened to be poking in the nix builtins and nixpkgs.lib for unrelated reasons and stumbled on builtins.compareVersions. I may still put a PR together for this, just to explore it.
Nix ships with
nix eval
andbuiltins.compareVersions
. Is there some reason we can't replace our version sorting/checks with this?I think it'd be something like the following:
This should reduce our dependency on external tools (or maybe you can think of it as deepening our dependency on one we certainly can't remove?)
The text was updated successfully, but these errors were encountered: