NixOS/nix

[FEAT]: Introduce new error message for packages without `mainProgram`

開放

#15,138 建立於 2026年2月3日

 (1 則留言) (0 個反應) (0 位負責人)C++ (1,293 個分叉)batch import
error-messagesfeaturegood first issuenew-cli

倉庫指標

星標
 (9,803 顆星)
PR 合併指標
 (平均合併 7天 11小時) (30 天內合併 83 個 PR)

描述

Is your feature request related to a problem?

Some packages have multiple binaries with different purposes therefore setting mainProgram is not desirable.

When mainProgram is not set for these packages nix run errors out with

error: unable to execute '/nix/store/abc/bin/xyz': No such file or directory

Proposed solution

A new error for packages that don't have the mainProgram attribute set, something like

error: in 'abc': 'mainProgram' isn't set

Alternative solutions

An option to set mainProgram to null for packages that desire to do so, leaving the default behavior of mainProgram = pname; intact. An error like

error: 'abc' doesn't have a default binary

would be better in this case.

Additional context

https://github.com/NixOS/nixpkgs/issues/486543

Checklist


Add :+1: to issues you find important.

貢獻者指南