Random Nix stuff I learned

getExe uses meta.mainProgram

The nixpkgs lib function getExe uses meta.mainProgram to get a path to the executable in a package. It’s final path will then be interpolated into $out/bin/{name}.

Source

Creating inline derivations in nix files

Sometimes one simply wants to write a quick script, or some other text file in a nix derivation.

The easiest way to achieve that is with the ‘trivial’ builders that nixpkgs has to offer.

Their descriptions in the manual

Virtual Machine tests

Nix has some cool infrastructure to test anything you can in a configuration of multiple virtual machines.

It has some warts, as the test script is written in python… But overall, it gets its job done.

Manual


Hemera sitting in front of a laptop with a NixOS logo on it.