tweag / nickel

Better configuration for less
https://nickel-lang.org/
MIT License
2.23k stars 85 forks source link

Allow my users to use contracts shared on GitHub #1962

Open GuillaumeDesforges opened 2 weeks ago

GuillaumeDesforges commented 2 weeks ago

Is your feature request related to a problem? Please describe. I would like users of my tool to use contracts I've written and share in a git repository on GitHub.

Describe the solution you'd like I'm fine with builtins to fetch (like Nix)

let {Foo} = import (std.fetch "https://someurl.com")

or asking them to run a command.

Describe alternatives you've considered I'm about to write my own bash script that will copy from remote to a .nickel/ folder, so user can then import ".nickel/foo.ncl"

jneem commented 2 weeks ago

I think this falls under package management (#1585). I've been working on a prototype (#1903), but there are still a bunch of design questions. I'm writing a summary, and I'll post it as a discussion when it's done.

If your users are ok with using a nix shell, the easiest solution that works right now is to use the nix shell to put the git repo in the nix store, and then set NICKEL_IMPORT_PATH

GuillaumeDesforges commented 2 weeks ago

I've ended up downloading and copying files.

https://github.com/GuillaumeDesforges/nickel-cbuild/blob/6d4d9c834d5eb1f41a0639a9f37d5b3f2d2b3f11/cbuild/cli.py#L29-48