NixOS/nix

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

Open

#15.138 geöffnet am 3. Feb. 2026

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)C++ (1.293 Forks)batch import
error-messagesfeaturegood first issuenew-cli

Repository-Metriken

Stars
 (9.803 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 4T 12h) (86 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide