Live data from Hacker News

NixOS 21.05

nixos.org

51–60 of 234 posts

Re: NixOS 21.05

#51

Earlier quoted context omitted.

Could you briefly mention an example of something that is difficult/impossible without first learning about Nix internals, and allude to what kind of internals need to be learned?

As one example, IIRC, I can run "npm install -g" on other Linux distributions, but can't with Nixpkgs (since npm will try to install the package to the nix store). Yarn would install it to the home folder.

Yea this can be very annoying when a package is not already in nixpkgs or it's out of date.

There was a similar issue if you didn't use Python virtualenvs properly, which was an early source of frustration for me personally.

Re: NixOS 21.05

#52

I've been smitten by NixOS ever since I first tried it 2 years ago. Its the first carefree experience I've had with my system. As a side note, this result includes first tiny contributions of mine! That said, I really hope the community gets their stuff together on Flakes. They're designated as experimental and official document doesn't recommend them, but all the cool kids are already using them everywhere and it is…

I really can't believe they didn't finalize Flakes in this release. The difference between it and the "standard" way of doing things is night-and-day. these sort of "secret better ways of doing things" that are not the default really frustrate and drive away new users

As another learner, I'm pretty upset about this as well. Standard install gets you nix 2.3.12 (https://nixos.org/download.html), but to get flakes, you have to be on nix-2.4pre20210503_6d2553a:

https://nixos.wiki/wiki/Flakes#Non-NixOS

(And yeah, obviously all the docs are non-flake too, which leads to confusion about flake.nix vs default.nix...)

Re: NixOS 21.05

#53
post #19
post #4

I recently moved my laptop, desktop, and a few servers from Arch Linux to NixOS with flakes and home-manager. It is amazing! The complete configuration for all machines is in a single git repository, I can share configuration between them, and a `flake.lock` file guarantees all machines are using the same version of everything. No more trying to remember what command I need to run to install and configure software an…

Honestly - how painful was it to learn and get working? And what limitations/niggles are left when using as a workstation? I love the principles behind Nix, and I like to use it to provide development environments (through nix-shell locally and then using the same setup in CI). But some things can be moderately painful to get going.

You're looking at a solid 10-20 hours of hacking stuff together to get a decent working system, and you still won't understand a good 80% of what you copied from various repos.

I've been using NixOS for a year now, and I have a definite love/hate relationship. Many times I miss the simplicity of Arch, where I understood _everything_ about my system and how it was configured.

NixOS is like learning everything all over again, but in a weird, poorly documented language+standard lib that nothing else uses.

I think when you are super comfortable with it, is when it becomes truly amazing. But that takes a lot of dedicated time and effort.

Re: NixOS 21.05

#54
post #50

Earlier quoted context omitted.

I use nixpkgs on my osx laptop for most everything over homebrew these days, I've upgraded nix to 2.4, but home-manager isn't compatible. Hopefully that will change soon.

Nix is a great replacement for homebrew, but the lack of native support for Apple Silicon at the moment is a blocker for me.

https://github.com/NixOS/nixpkgs/pull/105026 this was recently merged so that should start rapidly improving.

Re: NixOS 21.05

#55
post #16

Earlier quoted context omitted.

IMO the biggest blocker is documentation. The best way to figure out how to do something is typically to search around in the nixpkgs/NixOS options for what you're trying to do, then go read the code. There's very little in the way of "here's a common task that new users want to do and here's the blessed way to do it." Even something that should be Nix's MAJOR selling point, like "create a single repo that configures…

> Even something that should be Nix's MAJOR selling point, like "create a single repo that configures a bunch of machines, including some NixOS and some other OS" doesn't have a recommended way to do it. NixOps[0]? But yeah, it isn't featured as prominently anymore as it used to be... [0]: https://github.com/NixOS/nixops

NixOps is fine for pushing changes to machines (well, actually I think it has a lot of problems, and somehow the NixOps docs are even worse than the regular Nix docs as far as getting started and bootstrapping and doing basic tasks, but that's not the point). But it's all about the mechanics of pushing changes to your hosts.

It certainly doesn't give you any kind of opinion on how to, say, structure a repo that has your hardware configs, Home Manager on a non-NixOS machine, Home Manager on a NixOS machine, some systemd services, etc. And there's no reason to need NixOps to maintain a repo of three or four physical machines that you have around your house.

Re: NixOS 21.05

#56
post #30
post #4

I recently moved my laptop, desktop, and a few servers from Arch Linux to NixOS with flakes and home-manager. It is amazing! The complete configuration for all machines is in a single git repository, I can share configuration between them, and a `flake.lock` file guarantees all machines are using the same version of everything. No more trying to remember what command I need to run to install and configure software an…

Long time Arch user here but I'm growing more interested in NixOS by the day. I'm mainly “utilitarian” in my OS choice and other things being equal, Arch's AUR packages is what keeps me using it. How does the Nix ecosystem compare with AUR? Would you still recommend making the switch?

Almost everything I used on Arch is available on NixOS. In fact, for a lot of software I was able to use a more advanced configuration because NixOS makes it easier than Arch to set up.

I only ran into one hiccup: NixOS has an open pull request for supporting plymouth for silent boot with a LUKS encrypted drive. For now, I am stuck with an ugly password prompt when I turn my computer on.

Re: NixOS 21.05

#57
post #38

How is managing python packages or ruby gems on NixOS? I remember the experience was not polished a few years ago.

In general it is very nice. A common method is you create a `default.nix` file in the project you are working on and use tools that manage the deps for you. For example:

Rust+Cargo: https://gitlab.com/kevincox/watchlog/-/blob/22c877065f763b3d...

Node+NPM: https://gitlab.com/kevincox/kevincox-web-compiler/-/blob/9fa...

My only Ruby project is private but I just rolled my own with:

    export "GEM_HOME=$out"
    bundle install --jobs $NIX_BUILD_CORES
Then I can set the resulting derivation as $GEM_HOME in the build step.

And sorry, but I don't do much Python.

For development you then use nix-shell to build the environment with all of the dependencies available. The downside is that you either need to commit the default.nix to the project, or configure it to be ignored. But the advantage is that it handles everything for you. For example you can configure native libraries such as PostgreSQL client or openssl without worrying if they are installed on your system. This means that the entire dev environment is tested in CI (assuming that you run nix-build in CI).

This is also nicer than docker/VM based dev environments as it just prefixes your usual environment with the deps, so you still have your regular commands and development tools available.

Re: NixOS 21.05

#58

I've been smitten by NixOS ever since I first tried it 2 years ago. Its the first carefree experience I've had with my system. As a side note, this result includes first tiny contributions of mine! That said, I really hope the community gets their stuff together on Flakes. They're designated as experimental and official document doesn't recommend them, but all the cool kids are already using them everywhere and it is…

I really can't believe they didn't finalize Flakes in this release. The difference between it and the "standard" way of doing things is night-and-day. these sort of "secret better ways of doing things" that are not the default really frustrate and drive away new users

By the way things are, I doubt they'll be stable in next release either. There were some pretty fancy things in last year's NixCon so devs might just push on that.

But the problem is, many many new shiny things are so comingles with flakes that they are now stuck in limbo, thanks to the one amazing feature that was showcased back in 2019 and then rotted away in implementation hell. Initial RFC was rushed, barely discussed (there are lots of comments, but very little progress, as is the way with flakes) and then simply merged as experimental akin to pushing mess under the carpet. Well the mess was useful, but now the carpet is uneven and the first timers can barely walk straight. I just want a conclusion on flakes, any conclusion would be better than this stupid silent march.

Re: NixOS 21.05

#59

I've been smitten by NixOS ever since I first tried it 2 years ago. Its the first carefree experience I've had with my system. As a side note, this result includes first tiny contributions of mine! That said, I really hope the community gets their stuff together on Flakes. They're designated as experimental and official document doesn't recommend them, but all the cool kids are already using them everywhere and it is…

I'm glad we didn't yet stabilize because I am skeptical of a number of aspects to Nix. I suspect it's unduly popular because pure eval mode is a food idea, but there is little way to use it outside of flakes.

Re: NixOS 21.05

#60
post #4

I recently moved my laptop, desktop, and a few servers from Arch Linux to NixOS with flakes and home-manager. It is amazing! The complete configuration for all machines is in a single git repository, I can share configuration between them, and a `flake.lock` file guarantees all machines are using the same version of everything. No more trying to remember what command I need to run to install and configure software an…

So if I understand correctly, I could declaratively specify my workstation, say I want vim, podman, codium, kubectl, curl, tmux, firefox, zettlr. I could put this in a configuration and have my workstation anywhere I can grab that from? Is there some way I can boot-to-git-configuration? So I could do this in RAM on someone else's hardware, like a network boot?

>Is there some way I can boot-to-git-configuration?

Yes, the NixOS installer is a live disk with all the features of NixOS. I have booted configurations directly from IPFS in the installer, and many nix commands and functions support git (or GitHub) natively.

You can declaratively specify your whole infrastructure from software configuration to remote machines with their own VMs.

For example here's my nix function for matrix: https://0x0.st/-2CA.nix

It does a whole bunch of stuff.

First it reads in the hostname and domain from the system configuration and put that in a variable to be used when configuring the subdomains later.

Then it opens up your firewall, starts a postgres service, creates the matrix db/user, configures nginx for matrix.hortname.domain, gets your SSL certificate (and sets up automatic renewal), sets up matrix, and lastly a hosted web client at element.host.domain. All services run under their own users on the host system.

It's zero configuration, I just import that to any machine that I want and it's running a matrix server with all appropriate ancillary configuration done.

Post reply on HN