Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guix build (in addition to nix build) #32

Open
awb99 opened this issue Jul 5, 2024 · 1 comment
Open

guix build (in addition to nix build) #32

awb99 opened this issue Jul 5, 2024 · 1 comment

Comments

@awb99
Copy link

awb99 commented Jul 5, 2024

I have just noticed that you have a nix build for tmducken.
This is an amazing thing - having reproduceable deterministic builds is the future,
and for tmducken involving duckdb which is a binary, this makes complete sense.

I love and appreciate that you are going this route!!! I hope other clojure projects
that have a binary/graal build process involved (like babshka) etc will follow
at some point.

Could you add support to build (or use) tmducken (or rather duckdb) via guix as well?

why?
guix uses guile (which is a scheme dialect) for configuration and builds; so instead of
having to learn a dedicated language to build something with nix, a clojurer who is
familiar with lisp tradition can easily build their own system with guix.

GUIX package repo contains Java (package "openjdk" or "openjdk:jdk"), clojure (package "clojure")
and clojure-tools (package "clojure-tools") and of course duckdb (package "duckdb").

NONGUIX ships a couple of binary packages like babashka and clj-kondo:
https://gitlab.com/nonguix/nonguix/-/blob/master/nongnu/packages/clojure.scm?ref_type=heads

how?

You really just need to determine the path of the duckdb library at runtime.

guix package --list-installed=duckdb
duckdb	0.9.2	out	/gnu/store/z05gs003pkzarmxkdqi8hgf0k3yw4wzy-duckdb-0.9.2

So then for guix users you could add this function (not 100% workable, but I think you get the
idea):


(defn initialize-guix []
 (let [r (shell "guix package --list-installed=duckdb")
   (cond 
     (shell-error? r)
     (throw (ex-info "no guix system" {}))

      (uncompatible-version? r)
      (throw (ex-info "guix installed duckdb version is not compatible with this version of tmducken" {})) 
      
      :else
      ; guix duckdb package has the shared lib in /lib subfolder
      ; in my case /gnu/store/z05gs003pkzarmxkdqi8hgf0k3yw4wzy-duckdb-0.9.2/lib
     (duckdb/initialize! {:duckdb-home (str (get-path r) "/lib"})

I am not exactly sure why you use nix flakes. I think it is to include the shared lib in the jar.
So that the loading of the lib is only done at install time. However it could also be linked
in a more discoverable way and fail when the installed version is wrong.

Thanks!

@harold
Copy link
Contributor

harold commented Jul 5, 2024

Hi. The nix stuff is contributions from @craig-latacora and @thenonameguy, perhaps they'd have some opinion.

Since there are apparently many ways to do this, I wonder if it makes sense for them to be in this repo, or if it makes better sense for fans of these different approaches to maintain their own projects where the latest whizbang way to do each can be independently maintained?

We'd be happy to link out to such projects in the readme or other relevant places to help with discovery of your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants