jlesquembre / clj-nix

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

Issue with file name dash #65

Closed JonathanLorimer closed 1 year ago

JonathanLorimer commented 1 year ago

I end up with this error, I'm not sure if the issue is with clj-nix or some upstream dependency, but I am getting this error:

Execution error (FileNotFoundException) at maelstrom.process/loading (process.clj:1).
Could not locate amalloy/ring_buffer__init.class, amalloy/ring_buffer.clj or amalloy/ring_buffer.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
jlesquembre commented 1 year ago

Not sure if clj-nix has anything to do with that error, are you following clojure naming requirements: https://clojure.org/guides/learn/namespaces#_loading ?

Does your program work outside of the nix build? If yes, then it's an issue with clj-nix. In that case I'd appreciate if you can share an example to reproduce the error.

JonathanLorimer commented 1 year ago

@jlesquembre Thanks for the quick response. Here is the repo that I am packaging, I assume it works without clj-nix since its a well used project https://github.com/jepsen-io/maelstrom/blob/main/project.clj#L12 (I have linked to the dependency that is causing issues).

I am just putting together a repo right now, will post again once its ready.

JonathanLorimer commented 1 year ago

Here is the repo you can run nix build github:JonathanLorimer/maelstrom.nix#maelstrom -L to see the errors.

nix build github:JonathanLorimer/maelstrom.nix#maelstrom-lock -L --rebuild this command will print out the generated deps-lock.json.

jlesquembre commented 1 year ago

@JonathanLorimer Thanks for sharing the project, I'll try to build it myself with clj-nix. It's a nice example, since maelstrom has a CLI interface.

JonathanLorimer commented 1 year ago

@jlesquembre Sounds good, thanks for looking into this! Fwiw I have very little experience with clojure / lein, so I may be missing something very obvious here. Also the fact that I am trying to generate the lock as a separate nix derivation may be causing an issue.

jlesquembre commented 1 year ago

Something not clear in the documentation is that for leiningen projects a custom build command is needed. For maelstrom some extra customization is needed, I opened a PR to fix the build:

https://github.com/JonathanLorimer/maelstrom.nix/pull/1

I tested only the CLI test commands, let me know if you see any errors in the generated package.

JonathanLorimer commented 1 year ago

@jlesquembre I am still running into some issues. Is it possible that there is an implicit runtime dependency on lein or clojure or something like that?

https://github.com/JonathanLorimer/maelstrom.nix/pull/1#issuecomment-1625778285

jlesquembre commented 1 year ago

Closing, fixed in https://github.com/JonathanLorimer/maelstrom.nix/pull/1 Feel free to re-open (or open a new one) if you still have problems.