- 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.
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.
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?
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.
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).
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.
There you have it. Apples and oranges.
Flatpak is not just easier for packagers, it's miles ahead when it comes to simplicity for end users.
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
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.
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.