replit / rippkgs

A CLI for indexing and searching packages in Nix expressions
MIT License
153 stars 2 forks source link

package derivations missing `meta.mainProgram` attribute, causing deprecation warnings #32

Closed montchr closed 6 months ago

montchr commented 6 months ago

When I use lib.getExe from Nixpkgs on either the rippkgs or rippkgs-index packages, I see the following warnings:

trace: warning: getExe: Package "rippkgs-1.1.0" does not have the meta.mainProgram attribute. We'll assume that the main program has the same name for now, but this behavior is deprecated, because it leads to surprising errors when the assumption does not hold. If the package has a main program, please set `meta.mainProgram` in its definition to make this warning go away. Otherwise, if the package does not have a main program, or if you don't control its definition, use getExe' to specify the name to the program, such as lib.getExe' foo "bar".
trace: warning: getExe: Package "rippkgs-index-1.1.0" does not have the meta.mainProgram attribute. We'll assume that the main program has the same name for now, but this behavior is deprecated, because it leads to surprising errors when the assumption does not hold. If the package has a main program, please set `meta.mainProgram` in its definition to make this warning go away. Otherwise, if the package does not have a main program, or if you don't control its definition, use getExe' to specify the name to the program, such as lib.getExe' foo "bar".

Example

This is especially noisy when using lib.getExe on either package in a custom script to be used in a devshell. It's not really clear from the snippet above, but the wrapped output of this paragraph-long warning text can span several lines.

Note that rippkgs.packages here is equivalent to flake-parts' inputs'.rippkgs.packages where inputs' is the argument in perSystem.

(pkgs.writeShellScriptBin "rippkgs-index-flake" ''
  # TEST: ${lib.getExe rippkgs.packages.rippkgs}
  ${lib.getExe rippkgs.packages.rippkgs-index} nixpkgs \
    -o $XDG_DATA_HOME/rippkgs-index.sqlite \
    ${inputs.nixpkgs.outPath}
'')