this post was submitted on 03 Jul 2025
179 points (96.9% liked)

Linux

56044 readers
522 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
top 50 comments
sorted by: hot top controversial new old
[–] chaospatterns@lemmy.world 7 points 19 hours ago* (last edited 19 hours ago)

I really want to like Nix. The idea of declaratively defining my entire system sounds great. I can manage it with Git and even have multiple machines all look the same. I can define my partititioning once and magically get a btrfs disk working. Wow!

But I find the language confusing no matter how many times people say it's easy. I have a lot of experience with other programming languages so maybe it just doesn't mesh. It also gives terrible error messages that are hard for me to understand. And Nixpkgs is unpredictable for what version I'm going to get. One of the services I installed ended up being a release candidate version which was a surprise. What if I don't want the latest version of Docker? How do I pin it? Do I have to duplicate part of Nixpkgs? It just feels like a monorepo where everybody has to be on the same versions. Why on earth do the Nix language docs start by introducing math expressions instead of here is a simple self contained thing that installs one program. Here's how you configure it. Here's how you expand. Why does the dependency graph seem to pull in so many unnecessary dependencies? For example, I tried to build a minimal Docker image (which Nix looks to be a very good fit for), but I couldn't figure out how to strip out dependencies that likely were only used during build for a dependency.

I still like the idea and have managed to get my server defined entirely with NixOS which is very cool, but I can't recommend this to my tech friends because if I'm confused they will be more so.

[–] LeFantome@programming.dev 2 points 18 hours ago

I have not used Nix, so I may not know what I am talking about.

That said, I have been using Chimera Linux which uses the APK package manager. It works by maintaining a single file in /etc/apk/world that specifies all the packages the user wants on the system. This is used to calculate dependencies and install packages. When you “add” and “del” packages, all it is really doing is adding and removing from this list. If you remove a package, it will remove all the dependencies too unless they appear in the “world” file.

If you do not specify a version number for a package, you get the latest. But you can pin versions of you want.

If you copy the world file from one system to another, you get the same set of installed packages.

So, if I use git to backup my world file, maybe a couple of other entries in /etc, and the dot files in my home directory, I have pretty much everything I need to completely recreate my system.

Is it really worth all the extra complexity of Nix?

[–] msherburn33@lemmy.ml 10 points 1 day ago (2 children)

The Nix language itself is the hardest part.

Let me disagree there, the language is trivial. It's just JSON-lookalike with expressions, with a lot of nice touches that make using it much easier than all the alternatives (e.g. sane multi-line string handling, lazy evaluation, default values, powerful key/value sets, etc.). The only real stumbling for me when first encountering it was realizing that functions can only take a single argument (which can be a key/value set) and that functions are literally just : (e.g. (a: a + 5) 6 => 11). That's easily missed if you just look at a file without reading the documentation.

The thing that makes it hard is just the complexity of the actual package collection, your configuration contains literally your whole system, and it's not always obvious where to find the thing you need, since sometimes it's a plain package, sometimes it is a services.foobar.enable = true and sometimes you have to fiddle with override or other package specific things. Knowing that https://search.nixos.org/ exists is half the battle here.

There is also the lack of static typing that can lead to rather verbose error messages, but it's not like many other configuration formats have that either.

[–] heraplem@leminal.space 6 points 1 day ago* (last edited 1 day ago)

There are a few gnarly things about Nix, even for someone who's familiar with Haskell (the most similar language to Nix that's even close to mainstream).

  • Dynamic typing (you mention this briefly). Some people like the extra flexibility that dynamic typing gives, but there's a tradeoff: more errors. The thing is, due to NixOS's complicated structure, the traceback for an evaluation error might not give you any information about where the cause is (indeed, the traceback might not include a single line of your own code!). This makes errors unusually costly in NixOS specifically, so any language feature that causes more runtime errors automatically has a worse impact than it would in a more "normal" language.
  • The "standard library" (builtins) is extremely sparse. You basically have to depend on at least nixpkgs-lib if you want to get any real work done.
  • No real data abstraction mechanisms. No ADTs, no nominal types. The only composite types are attrsets and lists. The usual way to encode a custom type is as an attrset with a _type field or some such.
  • While we're at it, very limited pattern-matching.
  • Clunky list literal syntax: no commas between list elements. I can't tell you the number of times I've forgotten to surround list elements in parentheses.
  • Can anyone remember the rules for escaping ${ or ''? I have to look them up every time.
[–] SolarBoy@slrpnk.net 3 points 1 day ago

Using a language server like nixd also helps a lot with auto completing packages and options in your config.

Apparently people are also working on the nickel configuration language to address some of the nix limitations and difficulties.

[–] danhab99@programming.dev 9 points 1 day ago

I really feel compelled to share that I actually really fucking love nix. I've never felt so confident that my computer would turn on no problem. It was hard and it was rewarding.

Idk I guess I haven't had it for long but once I got my dotfiles the way I like I just stopped messing with it.

Also nix devshells are pretty dope (⁠◕⁠ᴗ⁠◕⁠✿⁠)

[–] phantomwise@lemmy.ml 30 points 2 days ago* (last edited 2 days ago) (15 children)

I've been stuck on Nix for two weeks because I thought it would be a good idea to put a distro I had never used but that wouldn't break on my backup laptop in case my main one ever broke. I just couldn't force myself to install debian, not that I have anything against debian, it's just... kinda boring, while Nix seemed very interesting. IT SEEMED LIKE A GOOD IDEA AT THE TIME I SWEAR.

Guess what happened... I broke Arch. Then I reinstalled and the next day the laptop broke. Then the next day I tried to get my data back and the hard drive broke. So, backup laptop with Nix for two weeks...

  • I really really really like the declarative stuff. Installing packages through config files is so nice I'll never lose track of what I've installed ever again 🥰 🥰 🥰 I was already using a git repo for all my config files + GNU Stow to symlink everything to its proper place, so adding the .nix configs to that setup was very easy.
  • Having a clean system on rebuild is great. No more clutter left everywhere that I don't know about, no more half broken stuff left lying around.

But...

  • It's not Arch. Not Nix's fault, but I kept hearing that it would be "like Arch but declarative"... and it's really not 😑 Everything seems over-complicated vs as simple as possible.
  • I absolutely hate the language.
  • What's with those error messages from hell???
  • And speaking of hell, every language that can't just use indentations like YAML instead of cluttering the code with {} and [] and () should have been relegated to the darkest pit of hell 20 years ago. But points to Nix for being less awful than JSON (the comma on every line but not the last thingy make me want to build a time machine to go murder the grandparents of whoever thought it was a good idea)
  • Packages are out of date even in the unstable branch (I know it's unfair since it's not trying to be a rolling release... but... but...)
  • Where are the source packages? Is that an Arch only thing? I liked having packages that automatically use the latest git commit without needing to manually install from source and manually reinstall each time I want an update like a medieval peasant... 😭
  • Nix packages are weird. Even someone who's terrible at coding like me can read Arch PKGBUILDS... I miss you Arch 😢
  • Apps not working because of paths that don't exist on Nix... what do you mean I need to patch the package myself? 😭 But at least there's steam-run, great preserver of what's left of my sanity.
  • Can't wrap my head around installing some stuff like VSCode extensions (the advice I got was "don't bother just do it imperatively 😑 )
  • Wiki is often sparse on info and not very helpful if you don't already know what you are doing (and I clearly don't 😅)
  • Hidden configs. Some stuff works on its own like pipewire even though I haven't installed or configured it (I went with a minimal install that just gave me a tty then build from there, no DE), and how it's already configured is not in the default config files. It's very confusing not knowing why some stuff works and how it's configured by default.

But it's kinda growing on me. Like mold. Or cancer. Brain cancer.

[–] msherburn33@lemmy.ml 4 points 1 day ago (1 children)

Where are the source packages?

It's reproducible, so random updates are a no-no. You can however just dump the Git URL in your flake.nix inputs and then override the src of the package with that. The source gets updated when you do nix flake update next time. Something like this:

inputs {
    ...
    mypackage_src.url = "github:myorg/mypackage";
    mypackage_src.flake = false;
    ...
}
pkgs.mypackage.overrideAttrs (oldAttrs: {
              src = mypackage_src;
              version = "nightly-${mypackage_src.shortRev or "src"}";
            })

[–] phantomwise@lemmy.ml 1 points 2 hours ago

Wow I had no idea you could do that, I'll try it thanks ! °o°

[–] iopq@lemmy.world 5 points 1 day ago (1 children)

Nix has more up to date packages than most distros have packages in total. There's a bot that goes around updating them automatically if they are from github. Maybe there's an issue with your package?

[–] phantomwise@lemmy.ml 1 points 21 hours ago

I think I might have been misusing the term "outdated", the packages are a few versions behind but they do work. I haven't run into packages that didn't work except because of path issues (fixed by using steam-run).

[–] HayadSont@discuss.online 4 points 1 day ago (2 children)

Packages are out of date even in the unstable branch (I know it’s unfair since it’s not trying to be a rolling release… but… but…)

Sure, some packages are outdated. But in terms of percentage of up-to-date packages, it's (AFAIK) the best out of any distro repo. And that's perhaps even more impressive of a feat when realizing it also sports the biggest repo. For actual stats: https://repology.org/repositories/statistics/pnewest

load more comments (2 replies)
[–] phantomwise@lemmy.ml 10 points 2 days ago (1 children)

I'm sure it'll get better once I'm more used to it, just venting a bit. Sorry for the rant

[–] Bluefruit@lemmy.world 6 points 1 day ago (1 children)

I found this very entertaining lol. And it also confirms I made the right choice not using Nix as my daily driver. This sounds like a headache.

[–] phantomwise@lemmy.ml 4 points 1 day ago

Yes it's a headache if you don't have a clue what you're doing and suck at coding like me, but the good parts might make the headache worth it depending on what you want of your distro. A week ago I couldn't wait to get a new laptop to reinstall Arch, but now I'm actually wondering if I should keep trying Nix... OH GOD HAVE I CAUGHT THE NIX BRAIN CANCER? 😭

[–] eecobb@lemmy.sdf.org 4 points 1 day ago* (last edited 1 day ago) (2 children)

I wonder what your thoughts on guix would be, especially considering your thoughts on the language

[–] phantomwise@lemmy.ml 5 points 1 day ago

Succinctly : "OH GOD MY EEEEEYES"

I'm not a fan of nested parenthesis... but aside from that I don't know much about the language, is it more convenient? Does it also suffer from the error messages from hell problem?

load more comments (1 replies)
load more comments (10 replies)
[–] steeznson@lemmy.world 7 points 1 day ago (2 children)

NixOS sounds like ansible in OS form and that has never seemed appealing. Happy to hear why my impression is wrong though!

[–] smiletolerantly@awful.systems 6 points 1 day ago (1 children)

Think about it like this:

  • with ansible, you are responsible for making sure that executing the described steps in the described order leads to the desired result

  • with nix, you describe what you want your system to look like, and then figuring out how to get there is nix's problem (or rather, is obvious to nix thanks to nixpkgs)

[–] steeznson@lemmy.world 2 points 1 day ago

Thanks for explaining

load more comments (1 replies)
[–] Sibbo@sopuli.xyz 5 points 1 day ago

It's missing the fact that the nix store can be huge, even if garbage collected regularly. This prevents me from using nix on my Ubuntu laptop with limited HDD space.

[–] traches@sh.itjust.works 39 points 2 days ago (31 children)

I like the idea of nixos, but I feel like it makes a bunch of daily sacrifices in order to optimize a task I do once every few years? I hardly ever get a new computer, but I install/uninstall/update/tweak packages on my system all the time. With a dotfile manager and snapshots, I get most of the benefit without any of the drawbacks.

[–] iopq@lemmy.world 4 points 1 day ago (1 children)

You only have one machine? I benefit from sharing configs between the laptop and the desktop. They are not the same, but I can easily copy paste a complex service I defined in my desktop to do the same thing on my laptop

[–] traches@sh.itjust.works 2 points 1 day ago (1 children)

I have a desktop, laptop, and a few VMs and servery things. Dotfile manager (yadm, which is a git wrapper) to sync personal settings, everything else I just do manually. The system-level configs are either different enough that standardizing them isn’t very helpful, or no more complicated than installing packages and activating services.

[–] iopq@lemmy.world 1 points 1 day ago (1 children)

Activating services is the specific task NixOS is great at, you can just add it and it downloads the packages and starts it and generates the configs

[–] traches@sh.itjust.works 1 points 19 hours ago

Yeah, I’ll probably switch eventually I’m just trying to talk myself out of it because I don’t have the time to learn right now

[–] dinckelman@lemmy.world 8 points 2 days ago

This is a good example of what people consistently overlook/misunderstand, when it comes to Nix.

Obviously you can remount a /home, or just pull the dotfiles from a personal repo, but the strength of Nix is also in that I can re-create my entire config exactly how it is defined. If i were to setup a machine completely from scratch, with a mature enough config, it will get me from 0 to my exact desktop completely unattended.

But there are also many more advantages to it, at least in my eyes. Let's take trying/tweaking new packages as an example. Yesterday I pulled an old repo for an Outer Wilds mod. The thing needs a dev environment, and a mod manager for the actual game. A nix shell got me both, I finished my work, and when I exit out of fish, both are gone, just as I wanted them to be.

Another good example would be partial os updates. I've used Arch for almost 9 years before switching to Nix, and pretty much a top3 Arch rule is not doing partial updates, or partial rollbacks. In case of a breakage, I would have to manually redownload an older version of a tarball, pacman -U the package, and then hope i'm not cooked. In the case of gcc incompatibilities, it can quickly become a massive pain in the ass. My nix flake would never experience this problem, because I already have two different scenarios available - either i build based on an older lockfile from my git repo, or I create an overlay for a specific input I need, so that it still pulls what it needs, and doesn't interfere with the rest of my system

[–] Phoenix3875@lemmy.world 14 points 2 days ago (5 children)

For DevOps, it provides consistency for every CI run and production deployment, especially when a whole system needs to be shipped.

load more comments (5 replies)
load more comments (28 replies)
[–] savvywolf@pawb.social 21 points 2 days ago (1 children)

Skipped to the "ugly" part of the article and I kind of agree with the language being hard?

I think a bigger problem is that it's hard to find "best practices" because information is just scattered everywhere and search engines are terrible.

Like, the language itself is fairly simple and the tutorial is good. But it's a struggle when it comes to doing things like "how do I change the source of a package", "how do I compose two modules together" and "how do I add a repo to a flake so it's visible in my config". Most of this information comes from random discourse threads where the responder assumes you have a working knowledge of the part of the codebase they're taking about.

load more comments (1 replies)
[–] iopq@lemmy.world 2 points 1 day ago (1 children)

If you download a binary you can just steam-run it and it just works

[–] smiletolerantly@awful.systems 1 points 1 day ago (1 children)
[–] SolarBoy@slrpnk.net 2 points 1 day ago (1 children)

This command will just run an executable file on nix. Normally only executables which are installed from the package manager will work.

appimage-run is another option. Which can be used to run, you guessed it, appimages

[–] iopq@lemmy.world 1 points 10 hours ago

But appimages will complain about unmet dependencies, so usually they don't work

[–] utopiah@lemmy.ml 23 points 2 days ago* (last edited 2 days ago) (1 children)

Meanwhile me as a barbarian installing Debian and copying my ~/.bashrc file (and a few others) if not just remounting /home/ in the new installation every few years.

load more comments (1 replies)
load more comments
view more: next ›