Open lwbt opened 2 days ago
Your wrapper script is the correct approach to this but your wrappers scripts appear to be incorrect — they do not pass parameters. Your second one is better, but still needs some work:
#!/bin/bash
flatpack run --command=keepassxc-cli org.keepassxc.KeePassXC -- "$@"
You may require additional flags for some flatpak programs (see #4085) that you might use due to security considerations.
Thanks for the thorough report!
It looks like we are almost there, just that the code does not expect what we are doing here.
There are a couple of things that are preventing this from working:
Configure to use Flatpak directly: ...
$ chezmoi config --- config --- [keepassxc] command = "flatpak" args = ["run", "--command=keepassxc-cli", "org.keepassxc.KeePassXC", "--"] ---
$ chezmoi doctor [...] warning keepassxc-command found ~/.local/bin/keepassxc-cli, cannot parse version from Usage: keepassxc-cli [options] command
The problem here is that chezmoi doctor
is not using keepassxc.args
when running keepassxc-cli --version
, this is a bug in chezmoi.
Edit: @halostatue's wrapper script solution is better, edit to remove mine.
... Your second one is better, but still needs some work:
#!/bin/bash flatpack run --command=keepassxc-cli org.keepassxc.KeePassXC -- "$@"
You may require additional flags for some flatpak programs (see #4085) that you might use due to security considerations.
You are right, I had a bash alias in mind (which would not work here) while writing this and forgot that I need to pass the parameters. Thank you.
The problem here is that
chezmoi doctor
is not usingkeepassxc.args
when runningkeepassxc-cli --version
, this is a bug in chezmoi.
I’m not sure that's a bug. Not all commands allow --version
to be used when other parameters are provided (or print errors when other parameters are provided with --version
).
I think that there's a possible argument for supporting flatpak in chezmoi command runners:
[keepassxc]
command = "keepassxc-cli"
flatpak = true
With this, chezmoi would internally transform that command to flatpak --command=keepassxc-cli …
. This would also allow chezmoi to do something like providing the --user
flag as noted for vscodium.
I don't think that this is something that should be supported for all command installers and runners (e.g., I don't see a reason to support mise run keepassxc
if that were in the mise registry), but flatpak is being pushed very hard by RedHat.
I would not be able to help with this as I don't use Linux by default.
I think having such support for flatpak is excessive and just passing user defined arguments to every invocation is enough.
I think having such support for flatpak is excessive and just passing user defined arguments to every invocation is enough.
I don't really disagree, even though I suggested adding it above. However as this issue suggests, there are issues with chezmoi doctor
with the user defined command and arguments when there are wrappers.
There is a part of me that thinks it would be good to add a "recipes" section to the documentation that captures solutions like this.
What exactly are you trying to do?
I use the KeepassXC Flatpak and want to configure Chezmoi to use the included
keepassxc-cli
.What have you tried so far?
Create wrapper script:
Configure to use Flatpak directly:
It looks like we are almost there, just that the code does not expect what we are doing here.
Where else have you checked for solutions?
Output of any commands you've tried with
--verbose
flagOutput of
chezmoi doctor
Additional context
This may affect other users who try to use and configure other apps in Chezmoi packaged as Flatpak. Immutable distributions like Steam OS (stronger) and Fedora Silverblue (weaker) encourage using Flatpak instead of traditional package management.