by mongol · 2y ago · 0 comments
An application can be thought of as a combination of the binary, libraries, resources, and state. By default the applications needs to be able to read any of these and be able to read and write the state. Unix's FSH's biggest problem is that it tries to group files together by type instead of grouping files together by application. Nix can technically group things by application, but it is not really standardized so things can get messy and it is still normal for applications to read and write files from anywhere.
That's not really scattered. /nix/store has the generated files. They get linked to /etc if the app requires that kind of thing - often it's just added to the arguments instead. ~/.config is for user preferences (possible to flip at app runtime or static) which are not a system setting. /var is for system services states. Those are very separate use cases and get managed in different ways. The apps should also never be aware that /nix/store is a thing.
To me they all look the same. For example you could have a /nix/state that had a directory for each program. Each program could have its own global and user specific state it could manage from within its directory.
NixOS already has that. It's called `/var/lib`.
> Each program could have its own global and user specific state it could manage from within its directory.
The user-specific state is (and should be) in each user's home directory, not scattered around in a bunch of system-wide directories, one for each application...
That's not just for convenience, but also for security (and privacy) reasons.
I'd be interested to know who gets to manage the user-specific state in your proposal. Does each app have it's own per-user directory for each user? i.e. if you have 1000 apps and 10 users, do you need exactly 10,000 user-specific directories? And if not, who gets to create these directories and when are they created/removed?
To be honest, it sounds like you're not aware of all the complexities and implications / consequences of what you're proposing, i.e. it sounds like you didn't think this through. But on the off-chance I'm wrong, I'd be happy to be proven so.
Those are features, not bugs... There are reasons for all of those existing and for why you wouldn't want everything in a centralized place.
> NixOS's handling of state is poor. Even ignoring the problem of it all being spread out it is not uncommon for secrets to make it into /nix/store which is world readable.
The secrets handling is a well-known issue and easy to avoid when you're familiar with Nix. Although yes, it can be a problem when people are not aware of it.
And I disagree with NixOS's handling of state being poor. Apart from this "secrets" problem you mentioned, it's not worse than other Linux-based operating systems and in fact it can be argued that it's significantly better.
Just the fact that /nix/store is mounted read-only is, on its own, already a huge improvement over letting users and applications installing and modifying the system in an ad-hoc fashion (good luck when you upgrade your system!).
Not to mention all the other advantages of /nix/store (such as user-installed applications, no package or library conflicts even if you install multiple versions of them, etc).
And as another example, the `stateVersion` feature is something that also makes upgrades a lot more reliable, and I know of no other operating system that has a similar feature.
Atomic configuration changes, booting into specific configurations, and system-wide configuration roll-backs (configurations which also include changes in package versions or even entire OS upgrades), also makes upgrades and configuration changes easy to try / fix if anything goes wrong. No other widely-used operating system has such a reliable configuration change mechanism, as far as I know.
But, you know, if you have other ideas of how things can be improved (apart from your idea of merging user and system-wide state into the same place, which I think makes no sense), I would definitely appreciate to hear it!
https://wiki.gobolinux.org/Overview/GoboLinux-Filesystem-Hie...
Source: https://nixos.wiki/wiki/Overview_of_the_NixOS_Linux_distribu...
That sounds horrible. NixOS sounded kind of interesting, but if that's true it kills any interest I had in it.