News for hackers. Stuff that matters.
Re:Zero to Nix, an unofficial, opinionated, gentle introduct... by SAI_Peregrinus on Monday January 23, 2023 @02:58PM (#34494103)
Fragmented documentation. Flakes are still "experimental" and their interface subject to change, but they're also widely acknowledged to be the better way to use Nix. There aren't that many Flakes-first docs, and many existing documents describe things that don't really work with Flakes, so the already incomplete & fragmented docs are even more incomplete & fragmented than it seems at first!

AFAICT, there's no way to use the Flakes-based tools (`nix develop` and such) in the shebang of a script, so you have to stick to legacy Nix when making a shell script or Makefile or Python script that uses Nix to set up the environment. That means no lockfile, which is annoying.

Troubleshooting errors can be a horrible exercise in frustration.

Making derivations for particularly complicated build processes can be a massive pain in the ass.

Re:Zero to Nix, an unofficial, opinionated, gentle introduct... by pxc on Monday January 23, 2023 @04:12PM (#34495120)
> AFAICT, there's no way to use the Flakes-based tools (`nix develop` and such) in the shebang of a script

For now there's nix-runner: https://github.com/clhodapp/nix-runner

Re:Zero to Nix, an unofficial, opinionated, gentle introduct... by SAI_Peregrinus on Monday January 23, 2023 @05:19PM (#34495922)
Nice, but that appears to need the (non-portable) `-S` option to `env`. POSIX only requires a single argument string to pass to the utility invoked (though the documentation has it as [argument...] the OPERANDS section uses the singular "a string" form)[1]. Further arguments may be ignored (it's implementation dependent). With `nix-shell` your shebang can be `#! /usr/bin/env nix-shell` and subsequent arguments can be on the following lines, and `nix-shell` itself knows to parse that. Busybox's `env` doesn't support `-S`, and Busybox is the standard shell environment in Alpine (for a common use).

[1] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/e...