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

Push RPM to Copr? #1800

Open
dngray opened this issue Jan 2, 2022 · 14 comments
Open

Push RPM to Copr? #1800

dngray opened this issue Jan 2, 2022 · 14 comments
Labels
enhancement New feature or request help wanted Extra attention is needed in dependency In a dependency, not in chezmoi patience Patience required, there is no date for this being fixed

Comments

@dngray
Copy link

dngray commented Jan 2, 2022

Is your feature request related to a problem? Please describe.

Redhat has a service called Copr https://copr.fedorainfracloud.org/coprs/ (they are like Ubuntu PPAs).

Describe the solution you'd like

It would be nice if there was an official repository. The Neomutt project has one for example.

This would mean Redhat users would automatically have the latest Chezmoi instead of manually having to download the RPM or make their own repository.

@dngray dngray added the enhancement New feature or request label Jan 2, 2022
@twpayne
Copy link
Owner

twpayne commented Jan 3, 2022

This is a great idea, but I would prefer to add support for this to the build tool that chezmoi uses so that other projects can benefit. See https://github.com/goreleaser/goreleaser/issues/2804 for details.

@twpayne twpayne added in dependency In a dependency, not in chezmoi patience Patience required, there is no date for this being fixed labels Jan 3, 2022
@dngray
Copy link
Author

dngray commented Jan 8, 2022

Another solution to this might be to create a flatpak, that way it could be installed on any distribution, that has flatpak.

It's not uncommon for commandline tools to have flatpaks, two examples being NeoVim and MPV.

One of the things I like about flatpaks is they can be installed "per user". ie flatpak install flathub --user io.chezmoi.Chezmoi for example.

@twpayne
Copy link
Owner

twpayne commented Jan 8, 2022

This would mean Redhat users would automatically have the latest Chezmoi instead of manually having to download the RPM or make their own repository.

Note that if you have installed chezmoi using an rpm package then the chezmoi upgrade command will download and install the latest version also using an rpm:

$ sudo rpm -i https://github.com/twpayne/chezmoi/releases/download/v2.9.4/chezmoi-2.9.4-x86_64.rpm
$ rpm -q chezmoi
chezmoi-2.9.4-1.x86_64
$ chezmoi upgrade
chezmoi version v2.9.5, commit af9290311e64e9f34b090c350be84070d1845863, built at 2022-01-05T22:11:53Z, built by goreleaser
$ rpm -q chezmoi
chezmoi-2.9.5-1.x86_64

Another solution to this might be to create a flatpak, that way it could be installed on any distribution, that has flatpak.

I had a look at build at flatpak of chezmoi, but:

  • The flatpak documentation states that flatpak is targeted at GUI applications, not CLIs.
  • To run chezmoi with flatpak you'd have to use the verbose command flatpak run io.chezmoi.Chezmoi.
  • Just building a simple flatpak requires downloading over half a gigabyte of runtime, which is a little heavy.

I'll add support for flatpak if/when it gets added to goreleaser/nfpm.

@dngray
Copy link
Author

dngray commented Jan 9, 2022

Note that if you have installed chezmoi using an rpm package then the chezmoi upgrade command will download and install the latest version also using an rpm:

That generally won't work though for immutable operating systems like Silverblue, microos. For Silverblue you want to do rpm-ostree install chezmoi-x.x.x.rpm which will layer the package as a local package.

In this case I thought about using Toolbox, but the issue seems to be changing the hostname from "toolbox" to that of the host containers/toolbox#98. I thought about using a podman container, but had other issues doing that containers/podman-compose#395

I suppose an alternative solution might be to not use .chezmoi.hostname and instead use a variable set to the hostname - a bit like what you did with your MacOS definition https://github.com/twpayne/dotfiles/blob/master/home/.chezmoi.toml.tmpl#L16

To run chezmoi with flatpak you'd have to use the verbose command flatpak run io.chezmoi.Chezmoi.

People generally have aliases so they don't need to write flatpak run all the time.

Just building a simple flatpak requires downloading over half a gigabyte of runtime, which is a little heavy.
With distributions like Fedora, Silverblue, etc you already have Flatpak for other reasons.

@skyfaller
Copy link

This is slightly off-topic, but I'm on Fedora and I'm using Homebrew to install Chezmoi, so I want to mention that as a workaround. https://docs.brew.sh/Homebrew-on-Linux

It's slightly annoying to bootstrap your Chezmoi setup if you have to install Homebrew first, but I'm not sure how much more annoying it is than adding an additional Copr repo.

@twpayne
Copy link
Owner

twpayne commented Sep 28, 2022

If you know anything about writing source RPMs and .spec files, I'd love to get your input on goreleaser/goreleaser#3412, which is the key step to resolving this issue.

@twpayne twpayne added the help wanted Extra attention is needed label Sep 28, 2022
@anthr76
Copy link

anthr76 commented Oct 4, 2022

FWIW I have recently submitted the package review for Chezmoi into Fedora here: https://bugzilla.redhat.com/show_bug.cgi?id=2130734

This is still at least a few weeks away as there's a couple more deps needed to be packaged.

@mirenradia
Copy link

@anthr76, is there an update on this?

@matmaer
Copy link

matmaer commented Dec 30, 2024

Another solution to this might be to create a flatpak, that way it could be installed on any distribution, that has flatpak.

It's not uncommon for commandline tools to have flatpaks, two examples being NeoVim and MPV.

* https://github.com/flathub/io.neovim.nvim

* https://github.com/flathub/io.mpv.Mpv

One of the things I like about flatpaks is they can be installed "per user". ie flatpak install flathub --user io.chezmoi.Chezmoi for example.

I think this is the way.

@twpayne
Copy link
Owner

twpayne commented Dec 30, 2024

Another solution to this might be to create a flatpak, that way it could be installed on any distribution, that has flatpak.
It's not uncommon for commandline tools to have flatpaks, two examples being NeoVim and MPV.

* https://github.com/flathub/io.neovim.nvim

* https://github.com/flathub/io.mpv.Mpv

One of the things I like about flatpaks is they can be installed "per user". ie flatpak install flathub --user io.chezmoi.Chezmoi for example.

I think this is the way.

Not really. Flatpak in its current form seems to be incompatible with chezmoi. Please discuss in #4168.

@matmaer
Copy link

matmaer commented Dec 30, 2024

One of the things I like about flatpaks is they can be installed "per user". ie flatpak install flathub --user io.chezmoi.Chezmoi for example.

I think this is the way.

Not really. Flatpak in its current form seems to be incompatible with chezmoi. Please discuss in #4168.

I come back to this later, at first sight, most (if not all) of your dependencies are already available in flatpak runtimes. I'm working on a gui for chezmoi.

However it will take time, weeks if not months, it's the first app I develop so it's all quite new to me, I'm not even a professional developer. Flatpak is an excellent way to publish a gui so I'll also have to flatpak chezmoi. That's the reason I arrived on this thread, as I was checking if it already exists.

@twpayne
Copy link
Owner

twpayne commented Dec 30, 2024

I come back to this later, at first sight, most (if not all) of your dependencies are already available in flatpak runtimes.

That's not the issue, though. The issue is that chezmoi relies heavily on being able to exec other programs, and Flatpak does not allow this. See the discussion in flatpak/flatpak#5999.

Flatpak is an excellent way to publish a gui so I'll also have to flatpak chezmoi.

This won't work. You can make a Flatpak of chezmoi, but chezmoi in Flatpak won't work.

@matmaer
Copy link

matmaer commented Jan 1, 2025

That's not the issue, though. The issue is that chezmoi relies heavily on being able to exec other programs, and Flatpak does not allow this. See the discussion in flatpak/flatpak#5999.

I depend on running chezmoi with with subprocess.run() in Python, as recommended in the chezmoi docs. So I don't see a solution in that case, time to focus on developing a cool app to deploy in the first place. Thanks for the feedback.

@lihaohong6
Copy link

That's not the issue, though. The issue is that chezmoi relies heavily on being able to exec other programs, and Flatpak does not allow this. See the discussion in flatpak/flatpak#5999.

You can exec programs within the sandbox with either flatpak-spawn --host or host-spawn. It'll also require the --talk-name=org.freedesktop.Flatpak permission. To actually make it work, chezmoi would need to
(1) Detect flatpak sandboxes by checking the container environment variable.
(2) When in a flatpak sandbox, prefix every invocation of an external program with host-spawn.

Flathub doesn't like this permission, though, since spawning arbitrary processes on the host renders the sandbox useless. If the range of tools to use is not large, it's also possible to package the most common ones into the flatpak. Anything more advanced would require the user to explicitly enable this permission, which I think is a good compromise because most users won't need neovim along with chezmoi. This is the solution I used when packaging yazi. It was not a fun experience building 10 dependencies along with the main executable, but the resulting program works for 90% of its use cases, with manual tweaking necessary for the rest.

As for XDG directories, you need additional filesystem permissions for those. Granting access to home is not sufficient since it doesn't change all the environment variables. Something like --filesystem=xdg-config:create would be necessary to write to the host user's configs. Same for any other directories.

I can definitely see a way for chezmoi to be packaged into a flatpak, but the sandboxing would make it very difficult: Flatpak was not designed for CLI applications that need to read/write files on the host.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed in dependency In a dependency, not in chezmoi patience Patience required, there is no date for this being fixed
Projects
None yet
Development

No branches or pull requests

7 participants