axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.49k stars 70 forks source link

normalize install dir structure #934

Open Gankra opened 6 months ago

Gankra commented 6 months ago

Because we initially regarded the CARGO_HOME structure as "overkill" the ~/some/path and $MY_ENV_VAR/some/path installdir strategies do not make a separate bin/ subfolder, which limits the scalability of the approach somewhat, and adds a ton of special case paths to installers/updaters.

Also the MSI installer really does its own thing altogether when installing to ProgramFiles.

We should change everything to be shaped like CARGO_HOME, with ./bin/ and ./env (on unix), with room to expand to having libs dirs as well.

This will require migrating existing users of ~/some/path, but will be good longterm.

mistydemeo commented 6 months ago

On Unix in particular, we should adopt the FHS layout. This lines up with the layouts used by both Linux and macOS. The paths we install to should be, essentially, mini FHS layouts with bin for binaries, lib for libraries, and we can consider things like share for config, etc.

We use a version of this today in the Homebrew installer config.

ashleygwilliams commented 6 months ago

so there was a long discussion in our internal channel about the merits of this normalization, which i will do my best to summarize here for a future design conversation in the near future.


personally speaking i think what i've realized typing this out is that if we go with this heirarchical structure, we are assuming that the dir a user is providing is not shared by multiple apps (likely using a different install/release process, and/or outside the repo). this comes down to the question- should an install dir and an app be 1:1. currently we take no stand on this, but i do think adding more structure means that we need to have a stronger opinion on this and/or let folks choose/opt-in to structures.

i started drawing this out in miro but typing file systems sucks so i didn't finish but hopefully this gestures at the issue. drawing this- another solution here is to have users make their install dir namespaced if they know they are publishing multiple apps there.

Screenshot 2024-04-17 at 7 18 44 PM