Global install
It would be great if dagger install always worked, no matter the current working directory:
| If... | Then... | Status |
|---|---|---|
| Workdir is inside a dagger module | Install into the current module | Implemented ✅ |
| Workdir is NOT inside a dagger module | Install into the home directory as if it were a module | Not yet implemented ❌ |
I propose implementing the second row: when calling dagger install outside a module, use the home directory as a pseudo-module instead.
Benefits
- Standardize best practices: "install first" is the recommended way.
- First call of a module is faster
- Example commands are shorter
Rather than putting it in $HOME/dagger.json and rely on find up, I think it's better to look for it in a "global" place like:
~/.config/dagger/dagger.json
Other than not polluting the home dir, I'm thinking what happens if you add a "source": ".". This would upload the entire $HOME directory to the engine. We can also forbid sources for this module.
One other feature I'm dying to have in this global module is global excludes, like git!
As part of #5583, I think we'll need some global state somewhere to track what compute drivers have been configured, and we'll need a place to put plugins.
I think it probably makes sense to use the XDG Base Directory Specification - this defaults to .config for config, .local/share for state (we can put downloaded plugins there). But then, users can also configure this to their preference.
Yes, XDG was what I basically alluded to. We already use it in our SDKs to know where to download the cli (automatic provisioning).
I've been trying to work around this by dropping a dagger.json at the root of my home directory, but I'm having trouble:
Error: failed to generate code: input: blob.diff.export resolve: failed to export: error from receiver: open /Users/shykes/.Trash: operation not permitted- Contents of my
dagger.jsongets randomly wiped by the Dagger CLI
Is there a way to have a reliable workaround?
As discussed with @helderco yesterday. This is now a priority for the UX we want in the dagger shell: "always install a dependency before using it"