Fork me on GitHub
Christian Pekeler08:05:18

We’re using babashka for the deployment script of our Clojure project, i.e. we have our-project/bin/deploy.clj that starts with #!/usr/bin/env bb. If this was in nodejs land, I’d add babashka as a dev-dependency to my project so that npm i would install babashka locally to my project and make the bb-executable available within the project. Is there something similar that I could do in Clojure land, so I wouldn’t have to require every collaborator to first do a global install of babashka on their machine?


@christian239 Babashka is probably more comparable to Node.js or Clojure itself than a library you would install with npm. But you could do:

bash <(curl ) --dir .
which downloads a copy of bb to the local directory

👍 1

Also a package manager like asdf or nix could perhaps help

👍 1

babashka was added to nixpkgs relatively recently, I was so happy

Karol Wójcik08:05:04

@borkdude would it be possible to specify an architecture for which pods should be downloaded?


@karol.wojcik Perhaps this is possible using bb -Dos.arch=aarch64 but no guarantees :)


I tested that, but did not work


If we would support this, then we would also have to include the os + arch into the directory structure to prevent clashes, currently that's not the case


We already have:

prepare                       Download deps & pods defined in bb.edn and cache their metadata. Only an optimization, this will happen on demand when needed.


We could specify to download a specific OS as an option to that thing


Please make an issue for the above, if you're still interested.


That isn't about depependency resolution but about a different issue. Babashka cannot load Java classes that are not built-in at compile time.

👍 1

Sorry if the answer is obvious but I'm having some trouble finding the answer. In the example prints everything in the terminal. So if I do this:

export some_var=`./download_html.clj  /tmp/`
echo $some_var
, the result is: > Downloading url: > Writing file: /tmp/ What should I do if I just want the return value (the result of the last expression)? Is there something I can do on the babashka side or should I just replace printlns with logs and make sure they're sent to stderr or something? The use case is multiple babashka scripts running independently one after the other, each piping its result to the next one (our CI workflow is becoming too complex so I'm testing the waters with babashka; so far I'm very happy with it! ❤️).

Bob B16:05:15

Piping is sort of dependent on stdout and stdin, so you'd want to make the prints to stdout only the essential thing(s). However, babashka.process supplies some niceities for working with calls out to processes, so you could add in some "interceptors" if you wanted. Another alternative would be babashka tasks, which is sort of like make with separate tasks, dependencies between tasks, and so on. With tasks, you could print stuff and have a separate return value (that is, you could print from tasks and have a return value from a shell call or something). (<>)


I'll check those out, thanks 🙂