Live data from Hacker News

Nix as OS X Package Manager

ariya.ofilabs.com

51–60 of 209 posts

Re: Nix as OS X Package Manager

#51
post #49

I recently set up a new server for a toy project with nixos and it was a pleasurable experience, even if I did have to pull together several sources of somewhat thin documentation. Recommended. Next time I set up a new dev machine I'm going to give nix a try for dev environment management. Using nixops to push a closure from your local system up to ec2 is very pleasing. It feels like the future.

NixOS is pretty awesome :) For anyone trying to start with NixOS, I suggest trying it out on a small DigitalOcean server. Check out this[0] blog post on some hints how to install NixOS there. A big help is IMO to get a solid understanding about how nix itself works[1]. Also check out some existing `configuration.nix` files on GitHub. Just google for "github configuration.nix". This might give you some inspiration wha…

I found this blogpost helpful:

http://zef.me/blog/5981/deploying-a-simple-node-js-applicati...

Re: Nix as OS X Package Manager

#52
post #17

Earlier quoted context omitted.

On that note, is there some valid reason Nix absolutely needs access to / to create /nix? Why can't it live somewhere else? I believe some parts can go anywhere, but /nix is hard coded for the rest, which I'm not entirely comfortable with.

The pre-built binary packages available from the Nix project are all compiled for /nix; this choice is baked in to the binaries, which refer to shared libs via absolute paths for example. I understand this path is configurable, but you'll be compiling everything yourself, unable to use Nix's binary cache. You also risk running into unique problems since everyone else is using /nix

> I understand this path is configurable, but you'll be compiling everything yourself, unable to use Nix's binary cache

Not necessarily. Homebrew compiles stuff for a special prefix then substitutes your own prefix when you install the binary. It doesn’t work with everything (that’s why some compiled packages are available for /usr/local only) but it’s a start.

Re: Nix as OS X Package Manager

#54

> curl https://nixos.org/nix/install | sh Stop doing this. Look, even if you are rolling your eyes and thinking, "it's https and I'm not Ed Snowden, I think I can afford the risk for the benefit of an easy install process", what happens if curl is interrupted? Are you excited at the prospect of a half-ran install script that you didn't even look at?

Take a look at the install script. It's not so complicated, pretty much only download a tar.gz. So why using curl?

> It's not so complicated, pretty much only download a tar.gz. So why using curl?

Because it goes further than just downloading a .tar.gz. It checks your OS and its dependencies; download the right tarball; check it has an install script; run the install script.

Re: Nix as OS X Package Manager

#55

I was forcefully relocated from my comfortable decade-old Debian home into OS X, and the package management here in unsatisfying. I'm looking forward to future posts that show how Nix is better than Homebrew or MacPorts, because that hasn't been demonstrated so far. And as a bikeshed nitpick, I was always unhappy with the meaningless rpm options, preferring apt's clearer options (rpm -qa vs aptitude search). I'm a bi…

    apt-cache search
aptitude isn't necessarily installed.

Re: Nix as OS X Package Manager

#56
post #15

When I first heard about Docker, I thought it did what Nix does. Then someone handed me a docker image saying, "I got this working on my laptop, deploy this. Isn't this great!". I had no idea how they arrived at that configuration. If something happened to them or that image, I wouldn't have known how to reproduce that "working state". So I am happy to see Nix / Guix become popular. It is what I imagined package mana…

I mean, that's exactly what a Dockerfile is for. I don't know of anyone seriously using Docker that isn't using Dockerfiles exclusively. I only know of a single time when it's valuable to "commit" a new image (recovering logs from a stopped container). None of which is to detract from Nix. Nix+Docker is a powerful combination. It takes Docker's declarative nature all the way down to the compiler used to build the bit…

The big difference is that nothing about Dockerfiles implies that the processes they perform to build an image are deterministic or repeatable. Will a build step that runs `curl https://github.com/something/whatever` do the same thing in six months that it does today? Docker doesn't help with that at all. Nix improves determinism by (almost) guaranteeing that if you build the same nix expression six months from now, you'll get exactly the same dependencies, all the way down to glibc. Either that or the build will just fail, if remote dependencies aren't downloadable anymore, which is always tons of fun.

Re: Nix as OS X Package Manager

#57

I was forcefully relocated from my comfortable decade-old Debian home into OS X, and the package management here in unsatisfying. I'm looking forward to future posts that show how Nix is better than Homebrew or MacPorts, because that hasn't been demonstrated so far. And as a bikeshed nitpick, I was always unhappy with the meaningless rpm options, preferring apt's clearer options (rpm -qa vs aptitude search). I'm a bi…

There's a new commandline tool in the works that will improve all those interfaces; I'm not sure how far along it is, though. Here's the discussion: https://github.com/NixOS/nix/issues/779

Re: Nix as OS X Package Manager

#58

Anyone who's used Nix for a while -- how does package availability compare to Homebrew or Macports? Other than the default.nix thing (which Homebrew also has a version of [1]) are there any other clear benefits to switching from Homebrew? [1]: https://robots.thoughtbot.com/brewfile-a-gemfile-but-for-hom...

I've been able to replace _most_ of what I wanted from homebrew with Nix. I still keep brew around for a few things that haven't been packaged (or packaged properly) for Darwin in nix, like bazel and aptly. Works out pretty well overall.

Re: Nix as OS X Package Manager

#59
post #3

Since I discovered Nix, I've been using it as a package manager for OS X and Linux. Every project my team is working on now has a default.nix file. Getting started on a project is so easy for a new hire now: just one `nix-env` away from a fully working dev environment! :D

By chance, do you have some public/sample projects that use this approach?

Yes! Look here: https://git.hso.rocks/hso/def

Is a Telegram bot that queries the RAE dictionary (Spanish). It doesn't have any documentation yet, though :S

You can look for the project deps code here: https://git.hso.rocks/hso

Re: Nix as OS X Package Manager

#60
Why use nix when pkg-src has been available on Darwin for over 15 years, boasts more packages, and has decades of support (plus Jonathan Perkin and the guys over at Joyent)? Why people assume the gross project known as homebrew (and the better macports, where homebrew gets all of their real package patches) are the only two package managers on OS X/Darwin is perplexing to me... Not to say nix is not interesting, but still. The OS X open source/package community would be insanely better if it was solely centralized around pkg-src.

https://pkgsrc.joyent.com/install-on-osx/

http://github.com/cmacrae/saveosx

Post reply on HN