161
submitted 1 day ago by [email protected] to c/[email protected]
top 50 comments
sorted by: hot top new old
[-] [email protected] 7 points 11 hours ago

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.

[-] [email protected] 5 points 8 hours ago* (last edited 8 hours 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.
[-] [email protected] 3 points 8 hours 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.

[-] [email protected] 7 points 16 hours 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 (⁠◕⁠ᴗ⁠◕⁠✿⁠)

[-] [email protected] 2 points 14 hours ago

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

[-] [email protected] 1 points 11 hours ago
[-] [email protected] 1 points 8 hours ago

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

[-] [email protected] 4 points 19 hours 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.

[-] [email protected] 6 points 21 hours ago

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

[-] [email protected] 5 points 11 hours ago

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)

[-] [email protected] 2 points 10 hours ago

Thanks for explaining

[-] [email protected] 0 points 13 hours ago

Ansible is idempotent with a lot of intent. NixOS is idempotent.

[-] [email protected] 28 points 1 day ago* (last edited 1 day ago)

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.

[-] [email protected] 3 points 11 hours ago

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"}";
            })

[-] [email protected] 4 points 14 hours ago

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?

[-] [email protected] 4 points 17 hours ago

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

[-] [email protected] 1 points 16 hours ago

Wait how does Nix Unstable have a better score than the AUR? With four times less maintainers? That's really impressive, especially considering how much more simple Arch packages are to make.

[-] [email protected] 2 points 14 hours ago

Because you end up feeling unsatisfied with running the thing until you package it. I don't even understand the Nix language and I still messed around with a couple of packages

[-] [email protected] 4 points 23 hours ago* (last edited 23 hours ago)

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

[-] [email protected] 2 points 22 hours ago* (last edited 22 hours ago)

I'm just seeing your comment after I recommended Guix, that I could read and understand Guile Scheme is what made me hop away from NixOS, the nixlang is an ungrokable mess

load more comments (1 replies)
[-] [email protected] 2 points 20 hours 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)

https://en.wikipedia.org/wiki/Douglas_Crockford

[-] [email protected] 1 points 17 hours ago

There's one evil genius responsible for both JSON and JavaScript? °o°

[-] [email protected] 2 points 19 hours ago

Yeah, fuck that guy!

[-] [email protected] 10 points 1 day ago

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

[-] [email protected] 5 points 1 day ago

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.

[-] [email protected] 4 points 16 hours 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? 😭

[-] [email protected] 2 points 22 hours ago

I absolutely hate the language

Check out Guix_System_Distribution, it's just like NixOS but uses a Scheme dialect which is a better language.

[-] [email protected] 3 points 10 hours ago

While some people love putting Lisp in everything, I really don't get it. Guix is far uglier than Nix in the language department. Scheme is not a configuration language and thus has none of the nice things that Nix has (multi-line string handling, defaults, lazy evaluation, inline expression, etc.), instead you get multiple levels of macro spaghetti. Furthermore, Guix forces you to turn everything into Scheme, where you can just use plain Bash in your Nix build steps, in Guix that is all Scheme.

I had spent a lot of years with Scheme before starting with Guix and then spend quite a few years with that, but even after all that switching to Nix just felt so much better instantly. Instead of trying to hack a DSL onto of Scheme you just get a language that's actually build for the task.

[-] [email protected] 2 points 20 hours ago

If you like parentheses anyway

load more comments (1 replies)
load more comments (3 replies)
[-] [email protected] 18 points 1 day ago

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)
[-] [email protected] 36 points 1 day ago

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.

[-] [email protected] 3 points 14 hours ago

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

[-] [email protected] 2 points 12 hours ago

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.

[-] [email protected] 1 points 6 hours ago

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

load more comments (35 replies)
load more comments
view more: next ›
this post was submitted on 03 Jul 2025
161 points (96.5% liked)

Linux

56005 readers
972 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