lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
grav 2018-07-25T06:50:53.000095Z

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

2018-07-25T09:37:20.000198Z

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

2018-07-25T09:58:06.000174Z

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.

2018-07-25T09:59:37.000191Z

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.

anmonteiro 2018-07-25T11:25:02.000195Z

omg

anmonteiro 2018-07-25T11:25:05.000316Z

@hlolli you’re a hero

1😄
anmonteiro 2018-07-25T11:25:43.000040Z

but that looks so brittle

anmonteiro 2018-07-25T11:25:51.000056Z

and subject to breakage should we change any deps at all

2018-07-25T11:27:33.000318Z

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.

2018-07-25T11:29:26.000008Z

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

2018-07-25T12:00:11.000190Z

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).

2018-07-25T12:03:49.000130Z

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

richiardiandrea 2018-07-25T14:34:33.000266Z

Woah

grav 2018-07-25T16:51:11.000302Z

@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

richiardiandrea 2018-07-25T17:38:05.000090Z

@grav author of that plugin here 😄 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

grav 2018-07-25T17:42:43.000404Z

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

grav 2018-07-25T17:43:09.000430Z

And thanks for the plugin btw 🙂

richiardiandrea 2018-07-25T17:45:00.000267Z

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

grav 2018-07-25T17:50:33.000432Z

And the edn file accepts :closure-defines?

mfikes 2018-07-25T18:50:54.000476Z

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"

mfikes 2018-07-25T18:55:23.000384Z

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

richiardiandrea 2018-07-25T19:23:54.000419Z

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

richiardiandrea 2018-07-25T19:25:31.000249Z

yep so just make sure you use :compiler as key: https://github.com/nervous-systems/serverless-cljs-plugin/blob/master/serverless-cljs-plugin/serverless_lumo/build.cljs#L68