I recently tried switching from Arch to NixOS and the experience I had can best be described as apalling. I have not had a new user experience this bad since my first dip into Ubuntu dependency hell back in 2016. I’d like to preface this by saying I’ve been a Linux user in one form or another for almost half my life at this point, and in that time this may well be the most I’ve struggled to get things to work.

Apparently they have this thing called home-manager which looks pretty cool. I’d like to give that a shot. Apparently I have to enable a new Nix channel before I can install it. I’m guessing that’s the equivalent of a PPA? Well, alright. nix-channel --add ..., nix-channel --update (oh, so it waits until now to tell me I typo’d the URL. Alright), and now to run the installation command and… couldn’t find home-manager? Huh?? I just installed it. I google the error message and apparently you have to reboot after adding a new nix-channel and doing nix-channel --update before it will actually take effect, and the home-manager guide didn’t tell me that. Ah well, at least it works now.

I didn’t want to wait for KDE and its 6 morbillion dependencies to download, so I opted for Weston. It wasn’t a thing in configuration.nix (programs.weston.enable=true; threw an error and there was no page for it on the NixOS wiki), but it was available in nix-env (side note: why does nix-env -i take upwards of 30 seconds just to locate a package?), so I installed it, tried to run it, and promptly got an inscrutable “Permission denied” error with one Google result that had gone unresolved. Oh well, that’s alright, I guess that’s not supported just yet – I’ll install Sway instead. Great, now I have a GUI and all I need is a browser. nix-env -i firefox gave me the firefox-beta binary which displayed the crash reporter before even opening a browser window. Okay, note to self: always use configuration.nix. One programs.firefox.enable=true; and one nixos-rebuild switch later, I’m off to the races. Browser is up and running. Success! Now I’d like to install a Rust development environment so I can get back to work. According to NixOS wiki, I can copy paste this incantation into a shell.nix file and have rustup in there. Cool. After resolving a few minor hangups regarding compiler version, manually telling rustc where the linker is, and telling nix-shell that I also need cmake (which was thankfully pretty easy), I’m met with a “missing pkg-config file for openssl” error that I have absolutely no idea how to begin to resolve.

I’m trying to stick with it, I really am – I love the idea that I can just copy my entire configuration to a brand new install by copying one file and the contents of my home directory and have it be effectively the same machine – but I’m really struggling here. Surely people wouldn’t rave about NixOS as much as they do if it was really this bad? What am I doing wrong?

Also unrelated but am I correct in assuming that I cannot install KDE without also installing the X server?

  • Unmapped@lemmy.ml
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    7 months ago

    I switched from arch to nixos a few months ago. I would recommended going straight to using flakes and never touching channels. Channels really confused me when I started.

    Also don’t ever use env to install packages. Just add them to your configuration file and run rebuild.

    This video help me a lot when starting. Its a bit old but I don’t remember anything being wrong. He goes over how to use channels and how to setup to update using flakes. Also covers homemanager setup. Nixos setup guide

    Also Vimjoyer has some great nixos videos.

    • dream_weasel@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 months ago

      Any particular reason to make the switch? Arch is solving all the problems for me that I know I have… But maybe there are others

      • Unmapped@lemmy.ml
        link
        fedilink
        English
        arrow-up
        3
        ·
        edit-2
        7 months ago

        The main reason I switch was the way packages work. When you install something that has a dependency say like python. Instead of using whatever python you have already installed it gets another python package that is the exact version the original packages needs. So everything you have installed that uses python has its own python. That way if your python gets updated for one thing it won’t break anything else that still needs the older version.

        Its probably just a skill issue but I used both manjaro and arch for years on main desktop and both ended up broke where I couldn’t update anymore because of that issue. I know it can be fixed somehow but I always made it worse when I tried. I also had the same issue happen on my other computers(arch) when I would not update them for extended period of time.

        Nixos not only fixes that by the way it does dependencies, but also because every time you “rebuild” it makes a new image you can boot from. So if a update breaks anything you just reboot back to the last working image. So the system is pretty much indestructible.

        Other things i love about nixos.

        • The Nixpkgs repo is HUGE. I never use snap or flakpak anymore. And its so much more reliable than arch AUR (IMO).
        • when you remove a package from your config and rebuild the image. Its as if it never existed on the system in the first place. Only any files in your home folder remain.
        • you can use nix-shell to temporary “install” packages. I use it a lot actually. There are few tools I use very rarely or if I want to try something new. You use it. Close the shell. Then it gets deleted next time you garbage collect.
        • I switch between desktop environments. Sometimes just to try others out. But mainly I run hyprland. But if I need a GUI for something I just build my other config file and reboot into gnome. Then when Im done I just reboot back to hyrland image. And gnome is fully gone again. As if it was never installed.
        • I keep all my configs for all three of my machines In the same git repo. If any of them go down. It would not take long at all to restore them back exactly how they are.
        • its been fun sharing my fully config setup. Zsh(plugins like fuzzy finder)/tmux/NeoVim(with a bunch of plugins)/themes/starship with my friends. I just give them my config with a few tweaks changing username and removing anything they don’t need.
        • You build one config. Get it just right. And you never have to do it again. No matter how many often you want to wipe your machine. One rebuild and everything is back. I just tweak my config as I go. And it applies every machine when I “rebuild” them.

        Okay that was a lot of rambling. Probably repeated a lot of same points. I normally would go back and clean it up but I dont have time atm. I hope it somewhat answers your question. I feel like I’m forgetting something too.

        If your interested you can try messing with nixos in a VM. Its pretty cool that if you make a config you like you can copy it from VM and use it. When I first switched I was pretty confused and it took probably two weeks to get my config anywhere close to what I had on arch. Most of that was trying to figure out how to config neovim plugins like LSP servers in home manager. Was so worth it though. Going from arch to nixos was every bit as great as when I moved from Window 10 to arch IMO.

      • AggressivelyPassive@feddit.de
        link
        fedilink
        English
        arrow-up
        2
        ·
        7 months ago

        You can’t really bork your system, since you can’t always roll back and since the entire system is declared in one file (tree) that should work flawlessly.

        In case of servers: the entire config is in one place. That can make maintenance much easier. At least for Homeservers. If you’re deploying a fleet, puppet or ansible might be the better tools.

        • wewbull@feddit.uk
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          7 months ago

          Right, but both of these were features of nix before flakes.

          Edit: realised I’d mixed in a concept from elsewhere in the thread.

      • thejevans@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        7 months ago

        For me the reasons were:

        1. I have a desktop gaming PC, a framework laptop, and a 2014 macbook air. Having one config that I can share between them makes maintaining all the systems that much easier.

        2. Using Arch I would either be in two states, and NixOS works great for both:

        • I’m not using any specific computer very often and I just want it to work when I turn it on, and I need to not worry that if I go too long without updates I’ll break something.

        • I’m playing around with some brand new software which usually means installing unstable dependencies from the AUR, and rolling back or containing those changes is difficult, so I end up breaking something, and then updates become a huge pain until I need to just wipe everything and reinstall

        1. I never really liked GNU Stow or other dotfile management systems, and having NixOS + home-manager solves that, too. You can run Nix and home-manager in whatever OS, but having EVERYTHING in one repository is much more convenient to me.