|
|
|
|
|
by yusefnapora
1407 days ago
|
|
I would love to see a "guided tour of nixpkgs," using real-world packages as examples and building up in complexity as you go. I feel like so many of the problem I encounter as a new nix user have been neatly solved already and there are probably tons of great examples in nixpkgs, but I have no clue where to look, or even what to grep for. It would be super helpful if there were a resource with examples of common problems and how they're solved in the real world. For example, say you're packaging something whose unit tests hit the network. There could be a link to a package definition in nixpkgs that overrides the check phase to disable the problematic test. |
|
- disabling the code that hits the network, whether by patching or by configuration ("--disable-downloads" or anything similar)
- or emulating it; e.g. if the script downloads a file, we can `fetchurl` it and move the downloaded file to its expected place. 9Of course, it works when the script does not override the downloaded file; otherwise, go to the previous option)
Two examples came to my mind:
- Arcan vendoring required patching its cmake scripts, because cmake does not honor the cache and tries to download things anyway:
https://github.com/NixOS/nixpkgs/blob/901978e1fd43753d56299a...
- cardboard didn't require it because meson honors the cache (and Nixpkgs configures Meson to not download anything):
https://github.com/NixOS/nixpkgs/blob/901978e1fd43753d56299a...