Clojurians
#lumo
<
2018-07-25
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

grav06:07:53

Is it possible to specify a closure define on compiletime from the environment? In shadow-cljs there's something like {:closure-defines {:my-define #shadow/env "MY_ENVVAR"}}, which goes in the shadow-cljs.edn config file

hlolli09:07:20

@grav you mean when compiling lumo or lumo.build.api?

hlolli09:07:06

and good news for nixos users, this eternal headache of getting it to work there, I hope I've ended it with this PR https://github.com/NixOS/nixpkgs/pull/44076 Basically no shortcut, blood sweat and tears were used to compile the whole thing from source, with every dependency targeted with sha-sums, node modules and jars.

hlolli09:07:37

and the way I compile it there, very verbose with clj, could be an alternative to compiling it with boot. As trying to make boot work in offline mode was a headache that I finally gave up on.

anmonteiro11:07:05

@hlolli you’re a hero

anmonteiro11:07:43

but that looks so brittle

anmonteiro11:07:51

and subject to breakage should we change any deps at all

hlolli11:07:33

yes, the change of deps wouldn't hurt. But I'd like to know how boot-cljs uses the build-api. So that I'm not requireing all these namespaces. As for the deps, it's aumomatically generated, both node and clojure deps, so I'd run it again for every new version.

hlolli11:07:26

specifically for this task I made https://github.com/hlolli/clj2nix which takes deps.edn and exports the nix expression with shasums

hlolli12:07:11

there's actually one bug in this, the binary is called directly, meaning the first cli parameter is ignored. I think I need to use wrapBinary (or just node process like on npm).

hlolli12:07:49

or sed process.argv.slice(2) to process.argv.slice(1) in src/js/cli.js

grav16:07:11

@hlolli I guess through the API. I’m using a serverless plugin for lumo (or rather a lumo plugin for serverless), so I’m not using the api directly

richiardiandrea17:07:05

@grav author of that plugin here :smile: I don't think you can populate the :closure-defines from the env vars in the serverless plugin...the plugin just accepts options from serverless-lumo.edn if I remember correctly

grav17:07:43

@richiardiandrea Ah, yes that’s right - there’s not a config file for lumo itself. I’m mixing it with shadow-cljs.

grav17:07:09

And thanks for the plugin btw :slightly_smiling_face:

richiardiandrea17:07:00

one thing you can do is to generate the serverless-lumo.edn file as part of one of the serverless lifecycle hooks

grav17:07:33

And the edn file accepts :closure-defines?

mfikes18:07:54

Hrm. This is odd. Trying to set :closure-defines manually doesn’t work in lumo:

cljs.user=> (set! js/goog.global.CLOSURE_UNCOMPILED_DEFINES #js {"foo.core.bar" "hi"})
#js {"foo.core.bar" "hi"}
cljs.user=> (ns foo.core)
nil
foo.core=> (goog-define bar "x")
nil
foo.core=> bar
"x"

mfikes18:07:23

(I was thinking that a workaround like this might be possible https://github.com/planck-repl/planck/issues/773)

richiardiandrea19:07:54

the .edn is just passed as compiler options so in theory it should work