Skip to content
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

Add pre-defined templates for config files of popular applications #885

Closed
MurzNN opened this issue Sep 14, 2020 · 15 comments · Fixed by #1458, #3121 or #3128
Closed

Add pre-defined templates for config files of popular applications #885

MurzNN opened this issue Sep 14, 2020 · 15 comments · Fixed by #1458, #3121 or #3128
Labels
enhancement New feature or request

Comments

@MurzNN
Copy link

MurzNN commented Sep 14, 2020

At now, when we want to add configuration of some new app to chezmoi, we must manually search needed config files and add it to chezmoi. I have found similar project "mackup", that have cool feature: pre-defined ready-to-use templates for popular applications, here is list of them: https://github.com/lra/mackup#supported-applications

Will be good to have same feature in chezmoi too, for simply type something like chezmoi add-app blender, instead of search for each configuration file/folder and add it manually to chezmoi.

What do you think about this idea?

@MurzNN MurzNN added the enhancement New feature or request label Sep 14, 2020
@twpayne
Copy link
Owner

twpayne commented Sep 16, 2020

Thank you, this is a really interesting idea. A couple of observations:

  1. mackup has a really nice configuration directory containing language-neutral configuration files. It would be easy to import this data into chezmoi.
  2. mackup is licensed under the GPL-3 whereas chezmoi has a MIT license. It's not clear if we can combine the two. I'm not a lawyer but an obvious question is whether mackup's configuration files are part of its source code.
  3. We need to think carefully about what should happen when only some of the configuration files associated with an application are present when you run chezmoi add-app. Should the absent configuration files be forced to be empty, be ignored, or something else?

Thank you again for proposing this: this is potentially a very nice improvment.

@twpayne
Copy link
Owner

twpayne commented Sep 18, 2020

A possible solution to point 2 is for chezmoi to read mackup's configuration files from an existing mackup installation (e.g. if you have already installed mackup with brew install mackup). This means that the two tools are distributed independently and should avoid licensing problems. The downside is that you have to install mackup before you can use the add-app command.

@MurzNN
Copy link
Author

MurzNN commented Sep 18, 2020

About point 2 - maybe you can talk directly with author of mackup about "joining forces" for manage shared independent catalog of .cfg files with app config files info, using current file format, on separate MIT license, that will use mackup and chezmoi together (and maybe other apps in future too)?

  1. We need to think carefully about what should happen when only some of the configuration files associated with an application are present when you run chezmoi add-app. Should the absent configuration files be forced to be empty, be ignored, or something else?

About missing files - I think, that good solution will be store them in chezmoi as some "waiting for source" state (maybe we can add new chezmoi attribute for this, something like managed_?), so check file availability on each run, and if file is absent - nothing happens, if appeared - add it to repository and start to manage, like other files.

@twpayne
Copy link
Owner

twpayne commented Jun 4, 2021

We're waiting for a response about use of the mackup data in lra/mackup#1733.

@twpayne twpayne added the waiting for response Waiting for a response label Jun 4, 2021
@twpayne twpayne removed the waiting for response Waiting for a response label Aug 5, 2021
@twpayne
Copy link
Owner

twpayne commented Aug 5, 2021

So, I gave up waiting for a response from the Mackup folk on this and implemented chezmoi mackup add in #1325. Please have a look and report what you think.

@twpayne
Copy link
Owner

twpayne commented Sep 4, 2021

@MurzNN do you still need this feature? It's implemented in chezmoi, but I propose to remove it unless it's actually used.

@twpayne
Copy link
Owner

twpayne commented Sep 24, 2021

It seems that nobody else needs or wants the feature. As the command was never documented, #1458 removes it completely.

@twpayne twpayne added the won't implement/fix This will not be worked on label Sep 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2021
@twpayne
Copy link
Owner

twpayne commented Jul 10, 2023

Reopening at the request of @eugenesvk in #1458 (comment).

@twpayne twpayne reopened this Jul 10, 2023
@twpayne
Copy link
Owner

twpayne commented Jul 10, 2023

Please 👍 this message if you want this feature.

Repository owner unlocked this conversation Jul 10, 2023
@twpayne twpayne removed the won't implement/fix This will not be worked on label Jul 11, 2023
@benbender
Copy link

@twpayne thx for your efforts – a complete solution of some sort would be great and a very distinctive feature for chezmoi 👍

@eugenesvk
Copy link
Contributor

Thank you very much for adding this! Though I've got an error trying to use it

chezmoi mackup add -n -v AltTab
chezmoi: "Python 3.12.0b4\n": cannot determine Python version

@twpayne
Copy link
Owner

twpayne commented Jul 29, 2023

Thanks for testing!

What is the output of

$ ls ls `brew --prefix`/Cellar/mackup/`mackup --version | awk '{print $2}'`/libexec/lib

on your system?

@eugenesvk
Copy link
Contributor

Thanks for your help (that \n threw me off, thought it was some parsing issue) ! Mackup's version is 3.11, and after I've changed the shell's version to 3.11, it worked! 🎉

Though is there any way to tell chezmoi explicitly which python to use so that it doesn't depend on the shell's environment, but always uses brew's python (which would always match mackup's, I guess)?. Another alternative would be to install mackup with pip, though brew's path is a tad bit more convenient

@eugenesvk
Copy link
Contributor

Thank for for a prompt update, can confirm that it's adding mackup's config even with a different shell python version!
One last missing piece is supporting user app config files (for overriding central database or adding an app that's not yet in the central database) located in the ~/.mackup folder

@eugenesvk
Copy link
Contributor

Thanks, cusom user configs also seem to work fine now!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
4 participants