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?
I appreciate by the tone of your post that you’re trying to be helpful, but:
Why? What are they? How would I find out about them?
All I’ve heard about flakes is that it’s an experimental feature that’s still evolving. Shouldn’t I learn the stable system first?
That’s what I’m trying to do. Doing everything the “nix way” but that means none of my previous knowledge is useful. It’s a very steep learning curve.
So you’re telling me I need to reverse engineer everything I want to do with no documentation. Great.
Why? What is it ? What problem does it solve?
Ok, a tangible resource to go look at. Great, will do. Thanks for that, but most other things you wrote put me off more than help me.
Nix’s biggest issue is that it has a steep learning curve and throwing more things (flakes / home manager) into the mix just makes it feel more daunting. That’s especially true when you’re saying to ignore what small amount of documentation there is.
The matter of flakes is complicated. Yes they are experimental, but in reality most Nix users use them despite that. I’m a bit on the fence on whether you should start with flakes because they do add some complexity. You can copy paste a sample flake configuration from the Internet (there are many but they all do exactly the same things) and you’ll probably be fine but telling people to just copy paste code they don’t understand feels wrong as well.
Regarding documentation… I wouldn’t go as far as saying you should avoid it entirely but it is in a very unfortunate state with a lot of wiki pages being outdated or just containing snippets that do things in very weird ways, or are over engineered to the point of being incomprehensible.
And that’s if someone bothered to write up anything at all. It’s a bit sad but reading from the nixpkgs GitHub (or other people’s dotfiles) is sometimes the only way to get certain information, such as valid values for package overrides.
I appreciate the response. You seems to understand why this is frustrating at least.
Since writing my question about flakes I’ve seen a few pointers from people and read a little more. It seems like flakes solve the “problem” of the channel not being pinned to a specific version in the
configuration.nix
.Honestly that doesn’t seem to be a problem worth worrying about whilst I’m learning, especially if it makes the documentation obsolete.
I don’t understand why people are so sold on it for beginners (yourself excluded).
I wish there were more resources I’m just tryina point you in a general right direction. I should a included more stuff though.
Use Flakes You can think of flakes as declarative channels, with the added ability of using multiple channels at once and importing other flakes. I use both stable and unstable on my system and my flake has both. They also allow you to import other projects that use flakes a great example of this is base16.nix and my neovim config, try running
nix run github:kyleraykbs/neovim
and add the expirimental features flag it will complain at you about if you dont have flakes enabled.To clarify, I ment declaratively, cause ‘the nix way’ isnt pure if you use channels and such, I could a been more clear about that sorry.
This is a complicated one… You aren’t reverse engineering it, its open source and in my opinion NixLang actually documents itself quite well, I haven’t had a problem with the readability of nixpkgs and there’s even a link to the source on search.nixos.org for any given option or package. On top of that NixOS is a rabbit hole of abstractions and at least personally I find it harder to build stuff for if I dont understand the layers of complexity that I’m standing on, reading the source is the only real way to do it as of current. But it is understandable that it might be hard to understand as a new user, and unfortunately my only suggestion is to read other peoples configs, that gave me a good idea of what to do and how to do it, still a pain of course but nix will hurt you a lot before it starts to get nice to use. Also once again vimjoyer is a wonderful resource for all of this.
It makes it so all config is done in NixLang and therefore can take full advantage of nix, it also allows you to drop your home configs or parts of it on on any machine with just the config. Its just nixos but for your home, and as I said in my last comment the more nix tracks on your system the easier your life is.
The learning curve just will be steep and as someone who got though its worth it.
My qualifications allow me to write
flake
on my own, and I have even tried doing it. But after a bit of figuring it out, I set the recommended ISO, connected an unstable channel (I used 24.05 back when it wasn’t mainstream), configured the whole system according to the NixOS Wiki and…used the system daily, delighted with its amazing flexibility and stability. I’ve described everything I don’t like about the “experimental features” hereI remember Dolstra writing on his blog that
flakes' are needed to "ensure the best tolerance". Haha, I ensure portability of my system with a single yusb flash drive. I think Dolstra got tired of messing around with NixOS and wanted to reduce development costs by annoyingly suggesting a switch to
flakes`.