past_pollution

joined 1 year ago
[–] [email protected] 1 points 1 year ago

Me exactly. I'm totally definitely for sure going to try out all the more complicated DEs and widget tools (eww, maybe AwesomeWM if I'm willing to learn Lua or Hyprland if I'm willing to try Wayland)... Someday

In the meantime, my BSPWM + Polybar setup is there and works while I procrastinate on trying anything else.

[–] [email protected] 15 points 1 year ago

I'm not remotely anything like an expert, and I don't use NixOS (yet) myself, but I've been heavily researching it and I'll try to explain it to you like I wish someone had explained it to me.

First, I'd like to point out that most Linux distros are more or less the same. The main differences between most distros are what kind of package manager it uses, how it handles software updates (delaying and testing them like Debian vs releasing them quickly like Arch for example), how many packages they have in their repositories, and what software, configurations, and themes they ship with. There's a few different ones, like the new immutable distros (like Fedora Silverblue), or something like Gentoo where you compile everything from source code instead of downloading precompiled packages, but it doesn't get much different than that.

NixOS is the first Linux distro I've seen that radically changes the formula.

The biggest thing is, everything is installed and configured "declaratively". In a normal distro if you want to install Firefox, you type "sudo apt install firefox" and it puts Firefox on your computer. On NixOS, you edit a config file for your entire system and add Firefox to a list of packages you want installed on your system. Then, you run a command, and Nix adds it. This is nice because it gives you an easy way to keep track of exactly what's on your system. If you want to remove something? Delete a line from your config and run it again.

This also works for other things. Configuration files also get set this way. On Arch, I had to edit a lot of files in /etc to get some virtual machines working properly. When I reinstalled one time, I had to figure out what I changed before and relearn everything to redo those changes. On NixOS, you tell your system what you want changed in that config and it does it all for you, exactly the same way every time. You can even do things like installing software from source code with it if you want a package Nix doesn't have. You can have it automatically download the source code, and follow instructions to compile it and set it up.

There's a lot more though.

When you run that command to install/uninstall/configure everything in your system's config file, it doesn't just take your system as it is and change it. If you do that there's a chance something got tweaked by you or some piece of software you're running. That could screw the process up. So instead, Nix just nukes and reinstalls your entire filesystem from scratch, doing it exactly how you ask in the config file. That way, you know it's exactly how you want it, nothing is different. (And in case you're concerned like I was, I think it does this really fast somehow. And it also doesn't touch your Home folder and any of your personal files)

This has some other bonuses too. It makes your system really hard to break. Since you're installing your filesystem from scratch every time, it (I think) makes the entire thing unmodifiable. You can't make changes to it directly. You don't have to worry about a bad package or a virus breaking something. And yet you can still tweak it to your heart's content, you just do it from that config file and it sets everything how you ask it to.

Plus, let's say you install updates, and a package has a bug that breaks everything and your entire system isn't even starting. You're safe, because NixOS saves backups of your filesystem. All you have to do is pick an older one at boot time and it'll take you to that one instead of the newer, broken version, and then you can fix the problem/broken package and go on with your day. (I think it does eventually start using a bit of disk space to have multiple copies. But you can go back and delete older copies.) Alternatively, just in case that fails for some reason, you still have your config file. If you save backups of that, or use something like Git to save every version of it to Github, all you have to do is run that file again and it'll install your system exactly as it was before something broke.

The last big thing is reproduce-ability and package dependencies.

First, packages. A big problem with software development, and making all the packages for a Linux distro, is dependencies and what people refer to as "dependency hell". Linux is cool because you can use one dependency for multiple packages. Package Bob can say "hey I need package Joe to run", and package Fred can say the same thing. And you don't need two copies of Joe, they can just share Joe. Unfortunately, occasionally you have a problem where Bob is designed to use version 1 of Joe, and Fred is designed to use version 2, and usually it's hard to install both at the same time. The best you can do is make two packages of Joe for your distro, let's say "joe-v1" and "joe-v2", and tell the people that make Bob and Fred to make their packages say which Joe package they need. It gets complicated and messy, and is a big reason why things break on other distros.

This is also a problem with being a developer. If you make a script that runs Python 6, and then your computer updates to Python 7, your script might suddenly not working. And you better hope your distro has a "python-6" package that you now have to tell your script to use. And hopefully it's not even more specific, like needing Python 6.13.7 when the "python-6" package is actually Python 6.14.2 and you can't get the very specific version you need.

NixOS fixes this by letting you use specific, exact versions of a package, and have multiple of them at once, and have every package say exactly which one it needs. I don't know if you're familiar with checksums/hashes, but basically it makes a hash for every package. If you change anything in that package (the version, how it's installed, build options, config files, anything), it'll have a different hash. And if another package only works with a very exact version of a dependency package, it can say which one it needs with the hash, and it'll just work because it's set up exactly right.

And finally, because of all of this other stuff, your system is extremely reproducible. If your system breaks and you want to reinstall, throw your config file in and regenerate and it'll be 100% identical to how it was. Throw it onto your second computer, give it out to people online, you name it. They'll get the same thing. Do you run servers, and want to set up 30 to be just like each other? Normally you'd have to do that manually and hope you don't mess something up, or learn a tool like Ansible. With Nix, just make a config file for it, throw it on all 30, and they'll be the same. Or what if you're a software developer, and you need to get a coworker to try what you made on their computer? Just give them the config, they can set up an identical test system and test it, tweak it, you name it, and you know it'll run exactly the same between both computers.

I think there are some drawbacks to Nix. The biggest one is the learning curve. The configuration files are all written in a (simple but unique) programming language, also called the Nix langauge. You basically have to learn it, and the basics of Nix in general, to use NixOS and do all the first time setup. I've heard people say that a Linux user learning NixOS is like a Windows user learning Linux. It's different, it's a bit. Plus, the documentation seems like it's in a rough spot right now. Multiple places that have documentation, none of them are totally complete, some are outdated, and they're all a bit confusing. And lastly, it seems like because of how the setup is done, installing and configuring some things will be different and potentially a lot harder than on other distros.

NixOS is probably overkill for what a lot of desktop users actually need. Awesome features that if you have them you probably won't ever want to live without, but a lot of things that are aimed at software developers and sysadmins, and with the learning curve it might not be worth it. If you run any normal distro and never need to reinstall your distro ever, you'd basically never need the features of NixOS.

But if you get past the learning curve, NixOS seems to be the most powerful, flexible, unbreakable distro in existence at the moment. At least it is of the ones I know about.

Sorry for the lengthy reply! And again, I'm absolutely not an expert. It's been almost my sole obsession the last month or two and I've been trying to understand everything as well as I can, but someone with real experience will probably find things I said that are wrong. But I wanted to explain it in a way that makes sense to pre-learning-about-Nix me from a couple weeks ago, because everything I've seen from longtime NixOS users seems to be full of confusing jargon, and hopefully it helps you too!

[–] [email protected] 48 points 1 year ago (2 children)

The problem is that nothing Red Hat has done justifies them breaking the rules.

Have they made tons of contributions back to open source? Yes. Do they need to make money? Yes. Are there organizations and people who are, in essence, freeloading off their work? Yes.

But here's the thing. At the end of the day, they chose to make their project open source and to build it on Linux. And that choice comes with rules that they (and everyone else that have used Linux or other FOSS projects) have to follow, no exceptions. You can argue that their motivations for wanting to do so are understandable all day long. You can argue the GPL is bad and shouldn't work this way. But they still chose this ecosystem.

Now, have they actually violated the GPL? We'll leave that up to the lawyers to decide I guess. But if we're only talking whether they should be allowed to violate the GPL, the answer is absolutely not. If they didn't want RHEL to be open source and stolen by freeloaders they should've made their own operating system with their own license.

[–] [email protected] 7 points 1 year ago

Not exactly. If one package needs foo as a dependency, and another package also needs foo, it won't download a second copy.

But if another package needs, say, an older version of foo, it can download the older version of foo and you'll have two foo packages.

This is possible because Nix packages have hashes to differentiate between them, so any package can ask for the exact version of foo it needs instead of asking for foo in general and hoping the version it gets isn't incompatible.

Pretty sure this is also different from other containerized package managers, like Flatpaks or Snaps, which I believe throw all the dependencies in with their packages so each package has exactly what it needs in its container, and which is obviously going to be much more bloated than having shared dependencies. As far as I know Nix on the other hand doesn't get any more bloated than other distros (keep in mind that regular distros like Arch will still sometimes have multiple versions of a package, for example Python).

[–] [email protected] 5 points 1 year ago (3 children)

I have very little familiarity with most immutable distros and I don't know how difficult they are to make necessary configurations to system files. If I can't change things that need to be changed, that's an issue for me.

That said, I've just started looking at NixOS, which is immutable from my understanding. It looks incredible, because you preconfigure everything exactly how you like in a config file then build the system from that config. It seems like the best of all worlds - total control over your system to configure it how you want, multiple easy fallbacks if you mess something up, no worries about forgetting what changes you've made or how to replicate/undo them, and the security and unbreakability of an immutable filesystem. For the first time since I started daily driving Linux, I think I'm going to distro hop.

[–] [email protected] 2 points 1 year ago

Don't believe there's any standalone widget tools that do what eww does like that, but if you're looking to implement this on a standalone window manager you could try AwesomeWM, which is the only other piece of software I've seen compete with eww in its widget capabilities. And I believe everything is done in lua.