Live data from Hacker News

What is Nix and why you should try it

yakking.branchable.com

141–150 of 201 posts

Re: What is Nix and why you should try it

#141
post #72
post #19

I can vouch for the immense improvement Nix has made to my software development process. I use NixOS on my desktop and laptop. At the OS-level, it gets a lot of things right: reproducible, immutable system configs; lightweight containers; devops with declarative configs. At a software project level, nix-shell is an indispensible tool. Compilers and interpreters aren't even part of my system-wide config; instead each…

By reading your comment and a little bit of the package declarations in some nix packages, it seems like the software package system of nix is very similar to rez. Rez ( https://github.com/nerdvegas/rez ) is used by some visual effects companies (including mine) to manage software packages. It allows us to have great flexibility in the mix & match of software versions and runtime environments.

Cool! Indeed, Rez does something similar on the package management side.

For Nix, this is almost a side-effect, however. Nix's primary task is to describe how to build packages, and the entire OS is just another package that groups all dependencies. You can make a single change to a file everything depends on and it will result in a new OS.

Nix can evaluate the entire system configuration in seconds, and build or download missing binaries in parallel.

As a result you can e.g. have a complete OS based on a different glibc (maybe with some patch you like) installed and running alongside the normal OS without the glibc patch. Packages that do not use glibc are simply shared.

Re: What is Nix and why you should try it

#142
post #100
post #29

Earlier quoted context omitted.

Nice. I started using macOS 5 months ago and it felt a bit as a step back coming from Linux. Does Nix work good with macOS?

I should mention that on High Sierra there’s a bug with kill(-1, ...) that sometimes causes Nix builds to lock up the whole system.

Also, the OS X windowmanager has a memory leak and you have to resart every so often. Yesterday mine was 22GB and after restart <100MB… Nothing to do with Nix, just venting ;-)

Re: What is Nix and why you should try it

#143
post #79

Earlier quoted context omitted.

There are efforts to get deterministic builds in NixOS, but it comes with downsides like very high build times.

Can you elaborate? I always thought deterministic builds would enable faster builds (because it would basically allow for downloading and verification of binaries).

As an example, gcc includes code generators that try a few random things in order to optimize code. So two builds, on the same system, won't result in the same byte code.

Also, build stamps like time, PID, path etc.

Re: What is Nix and why you should try it

#144
post #33

My experience with Nix was a real pleasure, and a complete failure. I set out with the goal of building a development environment for a software I was working on. I thought - Nix sounds like a better Docker, where it's possible to choose package versions independently of the rest of the system. It's perfect for testing! I found the package description language refreshing - it was powerful without getting too complica…

I had a similar experience, although in my case the stumbling block was virtualenv. It needed to zip some .py files installed by nix and that totally failed because nix sets mtime to 0 on files it manages. I get why that's a thing they do but zip only allows file times after 1980 or so. NixOS is a really, really interesting project that I will be very interested in using once it's ready for prime time.

Re: What is Nix and why you should try it

#145
post #135

Earlier quoted context omitted.

Interesting. Isn't that essentially a livecd? Have you considered using Archiso? If so, what do you see as the advantages of darch?

Archiso/etc are similar, but that lack some things. --- Layering ---- I can change my inherited build without rebuilding everything. For example: base > xorg-nvidia > plasma > homepc I can easily switch desktop environments by making "homepc" inherit "i3", or w/e. Each layer is essentially a "Dockerfile". If you understand docker, you understand how the images are built and managed. --- Fast switching. --- I can crea…

Thanks!

Re: What is Nix and why you should try it

#146

Earlier quoted context omitted.

Community. There may even be community-based sources for non-free packages, but they are explicitly ignored by the Guix project.

Anybody can run guix publish however and self publish their own non-free substitutes if they wanted, plus there's all the existing non-free substitute servers around, and you can try your luck with guix import from nixpkgs. The community won't help anybody if they ask for help with non-free software though. I haven't missed any non-free packages since switching to Guix surprisingly, I always seem to find a free alter…

> plus there's all the existing non-free substitute servers around

Where?

> The community won't help anybody if they ask for help with non-free software though.

This, specifically, is where Nix has the advantage.

Re: What is Nix and why you should try it

#147
post #71

Earlier quoted context omitted.

One great approach is the Hoogle search engine for Haskell [1]. The idea with that is that you search by type, instead of name. So if you were looking for a function to take a item, and return a list with n copies of that item, you would search for `a -> Int -> [a]`, which would give you back replicate. Looks like the Nix expression language is untyped, so this wouldn't work directly, but maybe adding a rough type si…

Some Smalltalks (Squeak and Pharo) have a wonderful tool called a "Method Finder". The way it works is you write a sequence of arguments and an expected result , and it suggests a method to call. For example, I just now tried it, entering 3. 4. 7 in the input. It suggested the following methods: 3 + 4 --> 7 3 bitOr: 4 --> 7 3 bitXor: 4 --> 7 Clicking on any of these opens a browser on the class and method concerned.…

I worked with Visual Smalltalk for years and early on I created my own tool which found all methods whose source-code contained a given string or string with wild-cards. It was surprisingly effective because it easily integrated into the Smalltalk browser-windows in general so rather than printing out the set of methods found it opened a list-browser with all the found methods in it, so I could then easily browse for their senders or methods called in them and so on.

So how did you know what to search for? A simple case was to look up the ready-built application's GUI which usually always contains some strings. So if you wanted to change something in the system which would result in a change to its GUI just search for source-code with some of the words you saw in the GUI.

Re: What is Nix and why you should try it

#148

I'm a big fan of Nix, but I really with there was a declarative way to define a user's environment similar to what NixOS has with /etc/nixos/configuration.nix. It seems a little strange to me to have a functional package manager, but an imperative package install process. I think there are a few projects like NixUP and home-manager that are looking to address this, but I'm hoping Nix will provide an official way to d…

It's coming: https://github.com/NixOS/nixpkgs/pull/9250

That's a bit too strong a statement to make based on a two-year-old still-open PR with an uncertain future. It seems like it might be coming at some point in the future.

Re: What is Nix and why you should try it

#149

Earlier quoted context omitted.

Does rez handle having an environment with two apps in it that require differing versions of the same dependency?

It takes a list of requested packages, does some dependency resolution to arrive at a matching package list, generates environment variable setting/exporting code (in Python, e.g. setting things like PYTHONPATH and MAYA_PLUGIN_PATH), then launches a new shell with that code. So, yes, you can have multiple shells with different packages in use simultaneously. I don't think it operates below the industry software packa…

I believe GP was asking if you could have packages A and B installed simultaneously if

  - A depended on version X of C
  - B depended on version Y of C 
  - X != Y

Re: What is Nix and why you should try it

#150
post #89
post #19

I can vouch for the immense improvement Nix has made to my software development process. I use NixOS on my desktop and laptop. At the OS-level, it gets a lot of things right: reproducible, immutable system configs; lightweight containers; devops with declarative configs. At a software project level, nix-shell is an indispensible tool. Compilers and interpreters aren't even part of my system-wide config; instead each…

To me, when i look at new distro, i look for how well the repo covers binary packages, i have no time/resource to build compilers/big projects. Last time i checked nix, there aren't that many packages in repo to be usable on laptop. But the package manager itself might be a good idea for dev environments, but all the languages i use provide similar facility(not counting system-library dependencies).

I used Arch Linux for a while (~3 years) before making the jump to NixOS.

Many things I got from AUR packages are binary-cached in stable Nixpkgs, not to mention "compilers" (GCC, clang, and various versions of GHC in my case). I don't know when you last tried it out, but binary availability isn't a problem now if you'd like to give NixOS a spin. The only thing I build from source is polybar[0].

[0]: https://github.com/jaagr/polybar

Post reply on HN