-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Use data dir instead of home dir for dioxus-related data #4445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I want to match where cargo, rustup, vscode, android, bun, deno etc place their configuration files and tools. It's nicer that dx places its tools and configurations in a similar folder. While 0.7 doesn't contain many of these files, we do want to place things like the global configuration and eventually dependency caching into this folder. I don't exactly know how to specify this, but maybe you have more expertise here? |
So you want
Thanks for glazing. I do, I almost completely cleaned my home dir1 with a bunch of env vars set. Here is some of what I have now in this regard: ({config, ...}: with config.xdg; rec {
home.file = with home.sessionVariables; {
"${GOPATH}/.keep".text = "";
"${WGETRC}".text = ''hsts-file = "${cacheHome}/wget-hsts"'';
};
home.sessionVariables = rec {
ADB_VENDOR_KEYS = "${dataHome}/android";
# Home/config paths.
CARGO_HOME = "${dataHome}/cargo";
GOPATH = "${dataHome}/go/packages";
KERAS_HOME = "${dataHome}/keras";
MAMBA_ROOT_PREFIX = "${dataHome}/micromamba";
OLLAMA_MODELS = "${dataHome}/ollama/models";
PNPM_HOME = "${dataHome}/pnpm";
RUSTUP_HOME = "${dataHome}/rustup"; # Not needed with fenix.
TEXMFHOME="${dataHome}/texmf";
TEXMFVAR="${cacheHome}/texlive/texmf-var";
TEXMFCONFIG="${configHome}/texlive/texmf-config";
WEKA_HOME = "${dataHome}/weka";
WGETRC = "${configHome}/wgetrc";
PATH = "${PNPM_HOME}:${GOPATH}/bin:${CARGO_HOME}/bin:$PATH";
NODE_REPL_HISTORY = "${cacheHome}/node_history";
PYTHON_HISTORY = "${cacheHome}/python_history";
};
}) {
home.sessionVariables = {
NPM_CONFIG_GLOBALCONFIG = "${config.xdg.configHome}/npm/npmrc";
};
xdg.configFile."npm/npmrc".text = ''
cache = ${config.xdg.cacheHome}/npm
'';
} Just stuff that accumulates. It's better to have it all set, so that if ever need to use some of the programs again, it will not start polluting my home dir again. wget, npm, and go are a bit picky and not as straightforward, but the majority are all alike.
You are describing at least 3 things: cache, config, data. So Dioxus should use For config specifically, I remember about https://crates.io/crates/confy from https://github.com/astrale-sharp/typstfmt. Might be good, though it will probably add one or three dependencies. Footnotes
|
I think the reality is that XDG is just one standard in a sea of platforms with their own inconsistencies. The goal here is to create one folder that we put everything into that you can just delete when you want it gone. If you want to inspect what we download, it's obvious to navigate there and poke around. If you want to swap the binaries we use with your own, that should be easy too. We want to store the user's config there too, so you should be able to easily edit it. It sounds like we need a edit: the name we use should be |
You miss out the fact that you can, and if you do backups, you are saving
If I want to suddenly and fully stop using
It's easy, but the
And if it's not set, what would it be? If you absolutely have to have one directory and will not change your mind, then it would be great to put it in |
Made some opinionated changes for mac and windows, but am leaving linux to the data_dir with a fallback to home_dir. We likely won't respect the full XDG spec (separating config, state, cache, etc). Also, there's a new DX_HOME var you can set. I also changed the directory from |
Mmmmm... The logical fallback would be |
I don't want Dioxus to become yet another app that will pollute my home dir. XDG Base Directory Specification exists for a reason.
Currently, I'm not sure if it's better to move it into a cache dir. Typst packages are located in the cache dir. If they don't exist they are downloaded. This is exactly what
dx
does, but with binaries.