jlesquembre / clj-nix

Nix helpers for Clojure projects
https://jlesquembre.github.io/clj-nix/
Eclipse Public License 2.0
139 stars 20 forks source link

Fix version aliases #71

Open bendlas opened 1 year ago

bendlas commented 1 year ago

deps.edn allows to use version aliases, like RELEASE or LATEST.

For deps cache, clj-nix resolves these to versions, without keeping the original alias resolvable.

Test case

{:deps {binaryage/devtools {:mvn/version "RELEASE"}}}

There are similar differences in given and used version for

jlesquembre commented 1 year ago

Good catch, I'll add support for RELEASE / LATEST.

SNAPSHOTS are already supported, I even have some tests: https://github.com/jlesquembre/clj-nix/blob/3dffacf858ec9eb882d06695734b5b4300aa9448/test/cljnix/core_test.clj#L102

What's the difference between version ranges and version patterns? I'm not familiar with * patterns in maven dependencies, and I didn't find any documentation about it.

I tried to add support for version ranges, but they are quite tricky. Here I have an example for version ranges, but it's quite hacky (for an old clojure-lsp version) : https://github.com/jlesquembre/clojure-lsp/blob/58947e43f51641b571682918a63e4e1e6b54bc4a/flake.nix

Anyways, given that I think version ranges are a bad idea, and how much time I already ~spent~ wasted trying to support version ranges, I don't have any plans to add support in the near future.

bendlas commented 1 year ago

What's the difference between version ranges and version patterns? I'm not familiar with * patterns in maven dependencies, and I didn't find any documentation about it.

I think I was confusing with exclusion wildcards please disregard.

Anyways, given that I think version ranges are a bad idea, and how much time I already spent wasted trying to support version ranges, I don't have any plans to add support in the near future.

Ack. Do you think we can make this case work: A transitive dependency has a version range, which gets overridden by a "closer" dependency with a regular version? Right now, that errors.

Maybe unsupported version expressions could be demoted to a warning, and assumed to be provided otherwise?

jlesquembre commented 1 year ago

Do you think we can make this case work: A transitive dependency has a version range, which gets overridden by a "closer" dependency with a regular version? Right now, that errors.

I think that was the case building clojure-lsp, there is a maven-metadata-central.xml file that is not captured in the lock file, and I went with the hacky solution of adding it manually. That's why mkCljBin accepts an undocumented maven-extra attribute. You could try that too.

While I don't plan to work on this, if you find a solution, I'm happy to help with a PR.

bendlas commented 1 year ago

Interesting, I'll try that workaround.

In the mean time, I may have a go at this at some point. But no promises either, I didn't end up needing that transitive dependency, for now.