News for hackers. Stuff that matters.
Re:How I develop with Nix by KirinDave on Wednesday August 12, 2015 @04:29PM (#10050411)
Recently I've been in various threads on HN complaining about how frustrating the Nix story is for development.

I do not read this and go "This is a great idea and process!" I read this and say, "I can see how this might be better than the existing haskell toolchain. Cabal-dev has always been a bit of a compromise." (Edit: showing how long it's been since I have used Haskell in anger, cabal-dev got deprecated in favor of native sandboxing about 2 years ago, my bad.) Haskell seems to be the common thread for nearly all users of Nix I've encountered in the wild.

Honestly, do other people read this and go, "This seems better than my current development toolchain?" ESPECIALLY if you're producing static binaries? As much as I criticize Maven, I'm not sure what this process buys you over maven except... well... what DOES it buy you over Maven dependency management? Unification with OS packages?

It's not immutable, reproducible deploys. The deploy side is easy to render immutable and reproducible with layerd, controlled, tagged containers. It seems to be a story that's more about the build and dev side of things. Heck, I showed this to a co-worker and he said, "Wow, cabal must be really bad if someone was so frustrated by it that their solution was to change their OS."

I don't mean to throw shade on the work that the Nix and NixOS people have been doing. I understand it has value to some people. It just seems very oversold as a solution to the problem of reproducible dev environments. And by adopting Nix, you MUST deploy your executable to something that can play nice with Nix's expectations, even if you are making a static executable. This seems like a heavy price to pay.

Re:How I develop with Nix by ayberkt on Wednesday August 12, 2015 @05:05PM (#10050612)
The thing about Nix is that it's the first project, as far as I know, that tries to solve the problem of package management with a fundamentally different approach. Most of the solutions to date were just okay: they worked with a tolerable degree of failure.

A solution that works good enough is often a serious obstacle for developing a solution that works really well. E.g. Unix works just good enough to preclude the adoption of a new paradigm in OS'es such as Plan 9.

Treating packages like immutable values sounds like a genuinely new idea. So what I think is that people don't go "this seems better than my current development toolchain", instead they think that the idea that underlies Nix might result in disproportionately more reliable tools in package management. That's worth fussing about.

Disclaimer: I am not associated with Nix in any way.

Re:How I develop with Nix by yenda on Wednesday August 12, 2015 @05:26PM (#10050733)
The first but not the last, there is also Guix the package manager and GuixSD the system distribution, which is written in Scheme, as well as all the package definitions. For lispers it is heaven.
Re:How I develop with Nix by KirinDave on Wednesday August 12, 2015 @06:34PM (#10051199)
I am assuredly a "lisper" and I really don't want to use anything based on Nix. I really dislike how statically linked executables are not portable on Nix. I'm less upset w.r.t. dynamic library management.
Re:How I develop with Nix by mbrock on Wednesday August 12, 2015 @06:04PM (#10051000)
(Guix is based on Nix, by the way.)
Re:How I develop with Nix by geggam on Wednesday August 12, 2015 @11:13PM (#10052079)
I am sort of curious. What problems are you having with package managers that building decent packages wont solve ?
Re:How I develop with Nix by technomancy on Wednesday August 12, 2015 @09:49PM (#10051896)
> As much as I criticize Maven, I'm not sure what this process buys you over maven except... well... what DOES it buy you over Maven dependency management?

I agree that using Nix doesn't make sense for application development where all the dependencies are resolvable within the language runtime. (Provided the runtime itself can be well-specified in the project configuration and the language's dependency management system defaults to exact immutable declarations.)

But throw in a dependency on Redis and Postgres, and you get into territory where traditional tools fall over pretty quickly, especially if different branches of your codebase depend upon different versions of Redis.

Personally Guix is more interesting to me as a way to keep my own stuff declarative rather than for sharing across a team of developers. But the cost doesn't seem too high if your application has external dependencies which traditional tools suck at; I've felt that pain and it isn't pretty.

Re:How I develop with Nix by mercurial on Thursday August 13, 2015 @12:29AM (#10052254)
> But throw in a dependency on Redis and Postgres, and you get into territory where traditional tools fall over pretty quickly, especially if different branches of your codebase depend upon different versions of Redis.

Surely you would just depend on the driver, which is most likely going to be written in your high-level language.

A better point may be languages which rely a lot on C libraries (think Ruby and Python), and where having something like pip won't magically install the ImageMagick dependency your software needs.

Re:How I develop with Nix by technomancy on Thursday August 13, 2015 @01:14AM (#10052367)
The driver's not much good on its own.

Traditional dependency systems force you to track the version of the server itself outside the project's configuration.

Re:How I develop with Nix by KirinDave on Thursday August 13, 2015 @02:09PM (#10056108)
It's very strange to imagine that you'd host a DB in a conceptually local manner to application services. This couples things in a way that's very awkward for scaling. Even if you're not using containers, you almost never organize deploys this way outside of beta/dev environments.

And if you were to make such a decision, then you'd capture it in the closure required to run the code you built, so you'd sort of bake in the inclusion of those services into any deploy of your code, using Nix's philosophy.

Or am I misunderstanding you?

Re:How I develop with Nix by technomancy on Thursday August 13, 2015 @08:47PM (#10058055)
What I'm saying is that you should have a nix package for your application and one for your database server. Whether these run on the same machine or not is a question for how they're deployed, but it should be the same package that's pulled in by the production recipe and the dev recipe in any case.
Re:How I develop with Nix by mercurial on Thursday August 13, 2015 @03:50AM (#10052751)
So? This kind of service often sits on a different box anyway in production.
Re:How I develop with Nix by technomancy on Thursday August 13, 2015 @04:18AM (#10052807)
I'm not sure what point you're making. Are you saying it's not important to run the same version of all your dependencies in development as in production?
Re:How I develop with Nix by mercurial on Thursday August 13, 2015 @10:45AM (#10054581)
I'm saying that in production, your application will likely connect to a database on a remote machine, which may or not have the same version as the one you packaged and you use for local development.
Re:How I develop with Nix by coolsunglasses on Wednesday August 12, 2015 @04:35PM (#10050443)
Nobody's used cabal-dev in Haskell-land for ages. Cabal has had native sandboxing since mid-2013 and Stack is a more recent alternative.

I'd argue Nix is nicer for everything but Haskell because the way Nix thinks about versions doesn't fit projects as neatly as one would think. As a Linux distro it's nifty (fully systemd-ified).

Cabal sandboxes have "just worked" since release in my experience (my own, plus hundreds of IRC users I've helped).

Re:How I develop with Nix by KirinDave on Wednesday August 12, 2015 @04:37PM (#10050453)
Sure, the last time I deployed Haskell for a paycheck it was still cabal-dev. I'm absolutely out of date there.

But I sort of struggle to imagine using NixOS to ship products, as it would mandate every dev maintain a comparable NixOS environment for development. In a world where even editor choice can be contentious and user-facing Linux only runs well on a small handful of machine types, this seems a little unfair.

Re:How I develop with Nix by sciurus on Wednesday August 12, 2015 @05:09PM (#10050628)
You don't have to switch to NixOS; you can run the nix package manager on any linux distribution or on OS X.

https://nixos.org/nix/

https://nixos.org/wiki/Nix_on_OS_X

A development team has to standardize on some things. Everyone might use their own text editor, but everyone can't use their own dependency management system.

Re:How I develop with Nix by KirinDave on Wednesday August 12, 2015 @06:31PM (#10051185)
This does't actually answer any real criticism I leveled except...

> but everyone can't use their own dependency management system.

This is untrue. Different disciplines use different tools for dependency management and it's not clear to me that the world is crying out for a unification here. Golang developers use one, Nim developers use another. Java developers have different requirements still.

Let's look at a pair of closely related langauges, Clojure and ClojureScript. While we might want a uniform method for DECLARING dependencies, the specific mechanisms used to fetch those dependencies may (and possibly should?) be different.

Re:How I develop with Nix by sciurus on Wednesday August 12, 2015 @09:02PM (#10051750)
I didn't say everyone globally, I said everyone on a development team, i.e. a group of people working together to build a product. Creating a reliable development environment for a team can be a PITA. That's why Vagrant, and more recently Docker, gained a lot of traction. People could use Nix to solve the same problem, like ris describes at https://news.ycombinator.com/item?id=10050681
Re:How I develop with Nix by KirinDave on Thursday August 13, 2015 @02:10PM (#10056119)
I just have a hard time envisioning package management as the light and the hope for this problem, at least at the level of granularity offered.
Re:How I develop with Nix by mbrock on Wednesday August 12, 2015 @06:07PM (#10051017)
As sciurus said, Nix can be used on other systems than NixOS. The package manager is the main idea, and the distribution is an extension of it to provide its benefits also for system configuration. The package manager doesn't touch your normal system file hierarchy at all; everything is isolated in Nix's own hierarchy; users can install packages without root; etc.
Re:How I develop with Nix by KirinDave on Wednesday August 12, 2015 @06:29PM (#10051179)
How does that actually answer the criticism though? You lose binary portability, you mandate Nix as a deploy AND dev target. You mandate that every development environment either is Nix-friendly OR that you're on the hook for writing said management.

And, as I've noted in the past, these packages people make as afterthoughts to product development are often broken. You end up welding your dev environment directly to your deployment environment and you complicate cross-platform builds quite a bit (closures cross-platform are, unless they have changed since early this year, not really a well-formed proposition).