Hi everyone!

I saw that NixOS is getting popularity recently. I really have no idea why and how this OS works. Can you guys help me understanding all of this ?

Thanks !

  • joshthetechie@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 years ago

    People love Nix because of the OS configuration based around a single config file. Essentially, you define your system configuration in this file, including installed programs, then you rebuild your system based on that configuration.

    The beauty here is that you can easily move this file to another machine running NixOS and reproduce your configuration there. You can also roll back changes by simply rebooting and choosing the last known good build and you’re back in business.

    • nani8ot@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 years ago

      NixOS has benefits not just for developers, altough being familiar with programming is helpful.

      For me the main benefit of NixOS is being able to keep multiple systems in sync. For that I have 3 config files, the first containing all general config and packages I want to have installed. The other two are for my laptop and pc respectively, which allows me to make system-specific changes. E.g. tlp is only enabled and configured on my laptop.

      And NixOS isn’t just rolling release, it also has bi-annual stable releases, which is great for servers.

      Rollbacks are also awesome, altough I used btrfs snapshots a few years back with Arch for a similar result. With a bit of setup they are bootable from grub.

  • Herbstzeitlose@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    Because it’s the latest Cool Nerd Thing™ like Arch before it, and Gentoo before that. Most of the people raving about it probably don’t have much use for its features.

      • commandar@kbin.social
        link
        fedilink
        arrow-up
        0
        ·
        2 years ago

        I don’t think that’s accurate, personally.

        Declarative orchestration systems have been around for years and have a very real use case when needing to stand up servers in a replicable way. Nix is applying that approach at the system level.

        I’m not entirely sold on wanting to put that level of effort into a personal desktop, but I don’t think it’s at all fair to say that it’s not addressing real problems.

    • IDe@lemmy.one
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      The features themselves are very useful for basically any user. Whether they are worth the non-standardness and issues that come with it is another question.

    • Clairvoidance@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 years ago

      Having the option to have multiple versions of a dependency without needing to have duplicates of the same version alá flatpak seems like it should’ve been a no-brainer on any linux distro.
      With that said I’m very comfortable with my current system, so definitely not until I get majorly fucked by my life-choices
      Definitely sounds like a competent player in comparison to most distros though.
      And I feel like the terminal isn’t as big a barrier as everyone makes it out to be (part of why I say that is because I think the entire concept of “beginner friendly distros” only makes the terminal seem more impenetrable through that wording)
      All-in-one config is definitely something I would’ve hoped Arch had as well, and as a bonus I would love a system that kept all things related to the user in /home (I’m not completely sure Nix does but I may as well throw that in) (homed does not do that as it still has entities outside of /home that you better back up, in fact you’ll risk being locked out of your user if you don’t)

    • Clairvoidance@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 years ago

      I was zzz until i heard having the ability to have different versions of packages installed at the same time without having the flatpak issue of having to have duplicates of the same package.
      All-in-one config is definitely something I would’ve hoped Arch had (I just like the idea of everything user-related stored within /home because that makes fucking sense, no, homed doesnt do exactly that) so I’ll definitely check it out if my harddrive ever crashes or something.

    • quaddo@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Thanks for this, it was definitely a nice overview. Not the first time I’d heard of NixOS, but I do seem to be seeing more frequent and more substantial discussions of it.

      What I’m getting from all this, is that it looks to be a great way to set up reproducible desktop environments. And servers too, I suppose.

      What I’m not getting from this: a compelling reason to switch from established players like RHEL and Ubuntu in combination with cloud-init and Terraform and the likes of Chef/Puppet/Ansible/Salt to spin up a cluster in the cloud, reconfigure, tear down, etc.

      In case anyone is misreading me: this is not a dig at NixOS. It definitely looks interesting. Like, to the point that I’ll at least spin up a VM on my Manjaro laptop and see whether I should perhaps consider wiping and reinstalling with NixOS. The “configuration through code” is extremely appealing here.

      My concern here is corporate inertia. And before anyone gets gets ready to launch a diatribe about how corporations don’t decide what the best tech is, I will agree with you. I’ve been around a while, and excitedly watched as Unix ramped up and displaced platforms like VAX/VMS and AOS/VS, using smaller and faster hardware. Then along came Linux and the battle for which distros would dominate.

      As for configuration through code, I’ve been keeping a keen eye on things (tinkering when it’s been possible to do so) since the days of cfengine and Jumpstart. I used to share this site with anyone that would listen to me; it’s dated now, but the underlying principles are (were?) solid: http://infrastructures.org/

      So for now, I think I’ll have to limit my professional NixOS usage to tinkering and potentially useful side projects. For personal usage? Yeah, it might become my daily driver, but I need to find the time to tinker.

      I will say that I’m presently involved in an effort to test something out that has my company’s product available using rpm-tree. Not my decision, this is all being driven by a customer that has a lot of clout; they really, really want to use rpm-tree. It’s proven to be a bit onerous at times.

      What this NixOS discussion has managed to do for me is to have me wondering whether a NixOS approach would have worked out better; my sense is that yeah, maybe it would have. But my feelings here might simply be the result of “woo, shiny new object”, which has definitely colored my opinions of things in my career of ~35 years. Something that I’ve had to restrain my excitement over, pending corporate sanity checks.

  • Cegorach@feddit.de
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    nah

    didn’t have enough time during the last half a decade to learn yet another thing

    might be better fit than my current debian setup - but how would I ever know, since my current thing is good enough?

  • Tilted@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    I used NixOS for a couple of years. My experience is like this:

    1. It is a rolling release (mostly)
    2. You write a declarative configuration for your system, e.g., my config will say I want Neovim with certain plugins, and I can also include my Neovim configuration
    3. It is stable, and when it breaks it is easy to go back
    4. Packages are mostly bleeding edge
    • priapus@lemmy.one
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      Important to note that NixOS has both a rolling release and point release version.

    • Atemu@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      2 years ago

      Note that there’s both the rolling unstable channel and a bi-annual stable release channel.

    • SirNuke@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Are you still using it and happy with it? I’ve been increasingly using single purpose dev VMs in a server, and a declarative configuration system would make the process of spinning them up faster and more robust. My current shell script system is clunky, and I’ve been looking at Ansible.

      • Tilted@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        2 years ago

        Yes absolutely. It is really great. It is also a source of frustration, e.g., missing configuration options, non-obvious options and so on. Overall it works well.

      • Sr Estegosaurio@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        2 years ago

        You can even define configurations for different systems/hosts/users from a single place. I’ev atomized my config and I can reuse lots of parts for my different machines. Also my user config is nearly identical (except hardware specific things).

  • moldyringwald@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    It’s insanely stable but you have to have a lot of linux/programming knowledge to do even the simplest things like installing/updating your software or making little tweaks. I played with it for hours the other day and I’m just too dumb to figure it out lol I think it’s just a super stable highly customizable distro for power users and a lot of people like that. If you can get over the learning curve it’s a pretty powerful and unique os

    • Glome@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      It’s true that it can be a powerful distro but I’ve also heard from some users that the advanced-level documentation is lacking and only limited to forums and source code. I think maybe if the documentation was more thorough I would try nixos.

    • Chobbes@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      It’s kind of funny because I’d put NixOS on a complete newbies computer for sure, and recommend it to an expert… But I’m less sure if I’d tell a random mid-intermediate Linux user to switch.

      Like if Grandma wants Linux on their computer to do some internet browsing for some reason… I’d absolutely put NixOS on it because it’s easy to manage the system for them… But somebody who is a little familiar with Linux already might be more confused about the differences. It’s kind of the ultimate beginner distro and the ultimate power-user distro, but a bit awkward between those extremes, haha.

    • RosalynKirk@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      you have to have a lot of linux/programming knowledge to do even the simplest things like installing/updating your software

      So, pretty much like any other distro

        • RosalynKirk@kbin.social
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          Weird, every distro I’ve tried either has no management, or doesn’t work. Just spins around loading. “Uninstalling” packages does nothing but remove them from the package manager.

  • fazo96@lemmy.trippy.pizza
    link
    fedilink
    arrow-up
    0
    ·
    2 years ago

    I have been using for years on servers. My lemmy instance is hosted on it.

    Although for desktop I had too many issues back in 2019 so I ended up back to Arch Linux and then EndeavourOS

    Would be fun to try again to use it on desktop

    • dbemol@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 years ago

      I think I will give it a try on a server first, I don’t have a playbook or script for a reproducible set up (yet), so I may as well use Nix to see if it’s worth the hype

  • 20gramsWrench@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    2 years ago

    I’m really not sure of where this would be anymore usefull than a simple bash script to install all packages you need since it doesn’t do configs and that rollbacks are supported by some filesystems already. Also Having version specific dependencies is already a thing for flatpacks and such

    • sickday@kbin.social
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      Part of the purpose of NixOS is providing a means to build a reproducible environment that’s easy to configure, migrate, and rollout. You can absolutely handle configuration of many different programs using either flakes or the native modules provided by nix. You can customize your entire system from firewall entries, to users and their shells, to the kernel itself and the kernel modules you’d want it to load, all in a single file or multiple files. If you want to try doing all those things in bash scripts, good luck and please share your experiences but don’t expect it to be as easy as the Nix ecosystem.

    • kevincox@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      There is a world of difference between a bash script and something like NixOS. The most important difference is that with NixOS something that you don’t specify won’t be there. Whereas a bash script (or other config management tools like Puppet, Chef or Ansible) only mutate things listed.

      So it is very easy to write a script like:

      ensure_installed python3
      write_file /etc/foo.cfg 'thing = 7'
      chgrp users /mnt/backups
      

      But if you remove ensure_installed python3 it will stay installed. You can try to be very careful and always add ensure_not_installed python3 but this is both error prone and dead code as soon as you run it. I used to have a script like this and I used each of configuration management tools mentioned above and always ran into these issues. The exact error flow would be something like this:

      1. Enable/setup some service A that pulls in package X.
      2. Disable service A or remove package X because it isn’t needed anymore.
      3. Write configuration for service B.
      4. Forget to add ensure_installed X but it works anyways because X is still installed from step 1.

      Now you have a non-reproducible config because if you try to re-install or setup service B on a new machine it won’t work because X isn’t present. This may sound like a niche problem but I ran into it almost every time I tried to bring up a new machine using my config.

      It is still possible to do this in NixOS as it isn’t completely reproducible (you can have mutable state) but in general it is much harder because any configuration that isn’t specified doesn’t exist. As soon as you remove package X or service Y from your config it is removed from your system. I’ve been using NixOS for 8 years now and this problem is mostly gone. It is definitely more reproducible than bash scripts and it has a tangible effect on my workflow.

      I wrote a blog post about it a long time ago but the core is still relevant: https://kevincox.ca/2015/12/21/service-management-with-nixos/.

    • priapus@lemmy.one
      link
      fedilink
      arrow-up
      0
      ·
      2 years ago

      A simple bash script is not reproducible or deterministic. Also a filesystem rollback is not the same as NixOS’s generation based rollback.

      Also, NixOS doesn’t just install packages, all system configuration is done declaratively, which would be a very bad idea to do via a bash script.

      • 20gramsWrench@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        2 years ago

        I have to check a little harder on what it does since I saw in a vid that you still needed to add your own if statement to get it working I assumed a simple

        pacman -Qk xorg-xrtrop 2> /dev/null && sudo pacman --noconfirm -S package1 package2 package3 || echo 'I aint got no x, idiot'

        would do the job as well

        • priapus@lemmy.one
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          I’m not familiar enough with Pacman to know what that command does. It’s definitely not as clean or easily manageable for servers as NixOS is. Especially not when you have multiple systems of which you would like some packages to be shared and others not. It also still doesn’t allow you to manage global system configurations.

        • Atemu@lemmy.ml
          link
          fedilink
          arrow-up
          0
          ·
          2 years ago

          I’d recommend reading some more; especially w.r.t. imperative vs. declarative.

          In NixOS, you’d do something like this:

          { config, ... }:
          
          {
            environment.systemPackages = if config.services.xserver.enabled then [
              package1
              package2
              package3
            ] else [
              # You could optionally make headless packages available here
            ];
          }
          

          You don’t need to understand the exact semantics here but you can look at it like JSON but with functions. This is not a “program”, the end-result is just data. You’re not modifying some stateful system state with new state from an uncontrolled source (i.e. the Arch repos) but rather just “outputting” a different dataset.
          NixOS then builds a concrete system out of this pure data specification. In this concrete system, those packages’ executables are available in the “global” PATH.

          You say “I want a system where x y z are installed” and it does it for you in a standardised manner. With the bash script, you explicitly tell it each step (“install x; install y; install z”). This pure data nature is what’s meant by declarative.
          This distinction rules out whole classes of issues you simply cannot run into with NixOS.

          Another aspect is that, as long as you use the same revision of Nixpkgs and the same config file, you can re-create the exact same system (almost bit-for-bit). If you were to run your bash script in a year’s time however, you’d get an entirely different system with totally different revisions of software and therefore possibly entirely different behaviour.
          This is what’s meant by reproducibility.

          You can achieve some of the same things NixOS does using imperative tools but nowhere near the same quality.