News for hackers. Stuff that matters.
Re:Linux desktop leaders unite behind Flathub app store. Her... by ar_lan on Wednesday March 15, 2023 @12:07PM (#35170465)
What advantages does Flatpak offer over Nix?

The only benefit(s) I see are:

1. Sandboxed applications - so applications you have don't technically have access to your home directories by default. That's sort of nice - but how many applications really warrant this overhead? 2. Possibly easier to write/package? That said, in Nix you pretty much just need to package once.

I've not used Flatpak - can somebody who is maybe familiar with both technologies comment further? While I may be a big Nix evangelist, it's always confused me a bit why Flatpak exists and I'm curious if it is truly solving a problem I'm unaware of.

Re:Linux desktop leaders unite behind Flathub app store. Her... by kirbyfan64sos on Wednesday March 15, 2023 @12:39PM (#35170946)
I actively use both Nix and Flatpak, and my perspective is that they're tuned for different purposes:

- Flatpak doesn't require apps to be rebuilt when the runtime changes, whereas Nix would require a rebuild. This is, of course, an intentional selling point for Nix: you don't have to worry about keeping track of ABIs and the like. This is, however, less fun when you have to update a large amount of applications for little reason. - When using flakes, it's easy to end up with a lot of extra disk usage because of a proliferation of different nixpkgs versions. Flatpak's runtimes help avoid this, since apps target a runtime version and can run under any individual commit for that version. - Flatpak has a massive amount of internal infra for sandboxing that would take a moderate effort to reproduce elsewhere. - This also means that running Flatpaks always involves new user namespaces; this can't just use environment variables like Nix does. - Flatpak's entire setup is more tuned towards GUI applications, with support for stuff like swapping out the graphics drivers. (nixOS can ofc do this, but you need nixGL otherwise.) - Flatpak has support for downloading non-redistributable files at install time and placing them in the same location as the application's main files. - Flatpak's summaries that it downloads from the server are much smaller than nixpkgs checkouts. - Flatpak dedups individual files across apps.

Really, it's just that Flatpak prefers keeping the build process and usage simpler to focus the energy on sandboxing, leading to design decisions like the more straightforward runtime/app split (easier for a user to understand / manage) and all of the built-in extras for graphical applications. Nix has a significantly more complex UX but is infinitely more flexible and also far better suited for development environments.

If your thought is "most of this isn't structural", that wouldn't be incorrect: there is no reason that:

- building flatpaks couldn't use a more nix-like model - nix couldn't add sandboxing and summary support on top

Heck, you could probably build a Flatpak from a Nix derivation, if you figured out how to separate the "runtime" and "app" parts. But at the end of the day, every tool has some limited degree of development bandwidth, and as-is, Flatpak and Nix just optimized that bandwidth for different targets.

Re:Linux desktop leaders unite behind Flathub app store. Her... by chungy on Wednesday March 15, 2023 @01:11PM (#35171465)
> Flatpak doesn't require apps to be rebuilt when the runtime changes, whereas Nix would require a rebuild. This is, of course, an intentional selling point for Nix

I doubt it's intentional. Guix has solved the problem---update the runtime without rebuilding the app---while being fairly similar to Nix's concepts in general.

Re:Linux desktop leaders unite behind Flathub app store. Her... by PurpleRamen on Wednesday March 15, 2023 @12:21PM (#35170657)
What advantages has Nix over Flatpak? Seems to be just yet another esoteric solution for installing software? Why should one prefer it over other solutions?

How well does Nix integrate packages into the system? Flatpak is integrating apps into the desktop environments. Probably just following standards, but is Nix doing this too?

Are Nix-Installations portable? I use Flatpak to have the same installation on different systems available, just move my SSD between them. How ell would this work with Nix?

Re:Linux desktop leaders unite behind Flathub app store. Her... by smoldesu on Wednesday March 15, 2023 @12:59PM (#35171248)
Theoretically, you could create a Nix-Flatpak hybrid by sourcing your Bubblewrap packages/environment from the Nix store. It wouldn't be much different from how Nix handles it today, just with an additional layer of sandboxing for each environment.

The problem Nix solves is the one Flatpak tries working around - how do I guarantee software builds and runs on my system? The answer turns out to be "very strictly", and Nix has done a good job of writing sane rules where it can. It's not perfect (and definitely not user-friendly today) but it has a larger package repo to work with and better support for stuff Flatpak is missing like system services. If people do want to switch to an immutable root system, I'd hope the goal is to be as modular as NixOS is someday.

Re:Linux desktop leaders unite behind Flathub app store. Her... by FengLengshun on Wednesday March 15, 2023 @01:14PM (#35171518)
From my testing it seems to integrate well enough. Mind, I'm still only dipping my toes to Nix on Vanilla OS for now, but I could install `git` and I could run `git` directly without `flatpak run` and the likes.

Optional dependencies seems to be an issue, though, as I needed to figure out what on my own I need to get thumbnails on Dolphin working correctly, but I might still be missing something that I'm supposed to do in this case.

As for portability, it seems doable with home-manager: https://julianhofer.eu/blog/01-silverblue-nix/#home-manager (itsfoss also have a pretty good NixOS guide that will cover home-manager as well).

Re:Linux desktop leaders unite behind Flathub app store. Her... by ar_lan on Wednesday March 15, 2023 @01:19PM (#35171623)
> What advantages has Nix over Flatpak? Seems to be just yet another esoteric solution for installing software? Why should one prefer it over other solutions?

It's not just for installing software - I have a declarative, shared configuration for each software that works deterministically on each system I share it with (NixOS or not).

> Are Nix-Installations portable? I use Flatpak to have the same installation on different systems available, just move my SSD between them. How ell would this work with Nix?

No, but the configurations are (see earlier response), so this seems to be the same benefit here.

> How well does Nix integrate packages into the system? Flatpak is integrating apps into the desktop environments. Probably just following standards, but is Nix doing this too?

I don't exactly know how to answer this - and it's probably partially because I don't use many modern desktop environments (when on NixOS I use i3, otherwise I'm on macOS, which is a bit of a specialized usecase). So I can't really comment here.

As far as installing immutable packages accessible from the system - it does a pretty exceptional job.

Re:Linux desktop leaders unite behind Flathub app store. Her... by AnIdiotOnTheNet on Wednesday March 15, 2023 @12:28PM (#35170756)
I don't have to learn a new language to use it and it is integrated with existing GNOME and KDE package install solutions.
Re:Linux desktop leaders unite behind Flathub app store. Her... by worksonmine on Wednesday March 15, 2023 @12:43PM (#35171010)
You're listing one of the biggest reasons flatpaks was even created as the only benefit. The reason it got some attention lately is the growing interest in immutable distributions where flatpak is sold as the userspace package manger while ostree handles the root system.

There you have it. Apples and oranges.

Re:Linux desktop leaders unite behind Flathub app store. Her... by lapser on Wednesday March 15, 2023 @01:09PM (#35171409)
Maybe it's because I'm naive when it comes to Nix, but so far everything Nix related I've seen requires some file configuration that no everyone is able to keep up with. Compare that to having a GUI frontend and a simple `flatpak install ..` command.

Flatpak is not just easier for packagers, it's miles ahead when it comes to simplicity for end users.

Re:Linux desktop leaders unite behind Flathub app store. Her... by ar_lan on Wednesday March 15, 2023 @01:20PM (#35171642)
Ah, this is fair. Where I view "flatpack install ..." as a negative, I do realize that most users likely view that as a positive.
Re:Linux desktop leaders unite behind Flathub app store. Her... by rewgs on Wednesday March 15, 2023 @01:24PM (#35171710)
The benefit of Nix is that you declaratively configure everything in a single file. And there's no reason you couldn't wrap a GUI around that. In fact I'd be surprised if someone hasn't already.
Re:Linux desktop leaders unite behind Flathub app store. Her... by Fire-Dragon-DoL on Wednesday March 15, 2023 @07:07PM (#35175921)
Nix sounds amazing and better than everything else, but it also sounds really hardcore and not for common usage.

You have to learn a specific programming language just to use it, so the barrier is: learn to use a computer, learn to program, learn a specific language

Compare that to desktop distributions, or windows, or macOS the barrier is: learn to use a computer

Re:Linux desktop leaders unite behind Flathub app store. Her... by ar_lan on Thursday March 16, 2023 @01:09AM (#35178327)
Totally fair, and understood! Thanks for the response.

I agree Nix’s biggest issue is that it’s extremely hard to consume. It took me essentially over a year before I felt… proficient in using it.

Re:Linux desktop leaders unite behind Flathub app store. Her... by Fire-Dragon-DoL on Thursday March 16, 2023 @03:30AM (#35179194)
That is so frustrating, it really sounds amazing, but I don't have the willpower to do that just for the day-to-day OS. Looking forward the day it gets more consumer oriented