News for hackers. Stuff that matters.
Re:NixOS Linux by sp332 on Friday June 12, 2015 @05:17PM (#9708607)
The package manager could just flock() a specific file before making any changes.
Re:NixOS Linux by millstone on Friday June 12, 2015 @05:33PM (#9708694)
From svn's red book:

By atomic transaction, we mean simply this: either all of the changes happen in the repository, or none of them happens. Subversion tries to retain this atomicity in the face of program crashes, system crashes, network problems, and other users' actions.

Does Nix mean the same thing? Is it atomic in the face of program or system crashes?

Re:NixOS Linux by cwp on Friday June 12, 2015 @05:49PM (#9708777)
Yes. In many cases, switching to the new version of the package is nothing more than rewriting a symlink. Sometimes it's more involved, like restarting a service. Either way, the cut over happens after building the new package has completed successfully. If building the package fails, it has no effect on the running system.

I suppose there is still a window in which an error could leave the system in an inconsistent state, but it's pretty narrow, and the error would have to be a kernel panic or something like that.

Re:NixOS Linux by millstone on Friday June 12, 2015 @08:47PM (#9709401)
Err, are there any systems that try to cut over to a new package before it's been built successfully?
Re:NixOS Linux by cwp on Saturday June 13, 2015 @12:19PM (#9711452)
Yes. Almost all of them, actually. By "build" I mean the whole package installation process, including moving the compiled files into their final destinations.

If you're upgrading an existing package, and that involves overwriting one binary in /usr/bin and another in /usr/lib, a crash in the middle of that process leaves the package partially upgraded, and very likely broken.

Nix never overwrites an existing package installation. Instead, it installs the new version in a separate directory, then overwrites a symlink that pointed to the old version with a symlink pointing to the new version.

Re:NixOS Linux by thrownaway122 on Saturday June 13, 2015 @01:30AM (#9710005)
I guess that traditional package managers could install a helper script or a config file early in the build system before the main package is finished.
Re:NixOS Linux by Lethalman on Friday June 12, 2015 @06:40PM (#9709014)
Things you must be afraid when using nix:

1) If you install a bad grub, you cannot rollback it using nix. That means, not a wrong grub line, but if grub itself is broken.

2) Anything that is not under nix control, the data: like desktop configurations, databases, ecc.

Re:NixOS Linux by davexunit on Friday June 12, 2015 @07:19PM (#9709148)
But after the first successful install you shouldn't have to worry about GRUB anymore. I don't know what it's like on NixOS, but on GuixSD we just change the grub.cfg.
Re:NixOS Linux by Lethalman on Saturday June 13, 2015 @06:56AM (#9710615)
You also upgrade grub versions I hope :) Or maybe improve the grub installation scripts.
Re:NixOS Linux by cwp on Friday June 12, 2015 @05:51PM (#9708786)
The contents of any package are immutable; once they're written they're never modified again. New versions of the package get installed in a different directory tree.