Open stuebinm opened 3 months ago
There is also at least one package (drawpile
) that has multiple executables but was affected by the treewide change anyway (fix in #306734)
bsd-finger: https://github.com/NixOS/nixpkgs/pull/304404
Not sure if this is the best place to report but this warning is occurring with the package caddy-latest
:
trace: warning: getExe: Package caddy-latest 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".
I don't have caddy-latest
package.
And caddy
has everything it needs: https://github.com/NixOS/nixpkgs/blob/f5afb674ec28f3647113ed7918adf8618de381df/pkgs/by-name/ca/caddy/package.nix#L76
Result: your nixpkgs
is out of date, I guess.
I don't have
caddy-latest
package.And
caddy
has everything it needs:Result: your
nixpkgs
is out of date, I guess.
I'm using a flake with nixpkgs/nixos-unstable
as an input.
Moments ago, I ran nix flake update
then rebuilt. The warning is still showing. I'm not sure what to make of that.
Edit: I'm using caddy as a NixOS module, if that is useful info: services.caddy.enable = true;
The issue is coming from your side. In nixpkgs
, it has a meta.mainProgram
since quite a while. You won't find the issue in nixpkgs
but on your infra. I also checked the NixOS module, nothing special in there.
There is no such thing as "caddy-latest
" in nixpkgs.
There was never and likely never will be.
It must come from your configuration or some input of that.
Edit: It's your own package @jordan-bravo. You will have to set meta.mainPackage
yourself if you want the warning to go away: https://github.com/jordan-bravo/.nix/blob/cf93ce7978f4a002caf1adb78228310043e18a1f/nixos/shared/caddy.nix#L6
I am using a caddy plugin. I have a nixos file I've created with the following content:
# sovserv/caddy.nix
{ pkgs, config, plugins, ... }:
with pkgs;
stdenv.mkDerivation rec {
pname = "caddy";
# https://github.com/NixOS/nixpkgs/issues/113520
version = "latest";
dontUnpack = true;
nativeBuildInputs = [ git go xcaddy ];
configurePhase = ''
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
'';
buildPhase =
let
pluginArgs = lib.concatMapStringsSep " " (plugin: "--with ${plugin}") plugins;
in
''
runHook preBuild
${xcaddy}/bin/xcaddy build latest ${pluginArgs}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin
mv caddy $out/bin
runHook postInstall
'';
}
Note: this warning was not occurring prior to updating my flake input of nixos-unstable
today. The previous time that it was updated was approximately 3 weeks ago, to put a timeframe on it.
Edited my initial comment (again) right before you posted.
The important bit is
You will have to set
meta.mainPackage
yourself if you want the warning to go away: jordan-bravo/.nix@cf93ce7
/nixos/shared/caddy.nix#L6
So basically you're rewritting a caddy
derivation without meta
attributes... and you're complaining that it's throwing a missing meta.mainProgram
warning?
Thank you for the reply.
To set meta.mainPackage
myself, would it look like this?
stdenv.mkDerivation rec {
pname = "caddy";
# ... other stuff
version = "latest";
meta.mainProgram = "caddy";
}
I'm not sure if that's the right value.
Yes. How about you trying before commenting?
This is something of a post-scriptum for https://github.com/NixOS/nixpkgs/pull/297084: some packages in nixpkgs have
meta.mainProgram
set to a program name, but no executable with that name actually exists according to the unstable channel'sprograms.sqlite
.Unlike the mass-adding of
meta.mainProgram
for single-binary packages, I can't think of any easy way to fix theses cases, so I thought I'd at least open an issue about it.Currently, there are 114 of these:
$out/bin
according toprograms.sqlite
bsd-fingerd
finger
cbor-diag
cbor-diag
ccacheWrapper
ccache-links
certi
certi
clang-tools
clang
clang-tools_12
clang
clang-tools_13
clang
clang-tools_14
clang
clang-tools_15
clang
clang-tools_16
clang
clang-tools_9
clang
cloudrecon
cloudrecon
codeberg-pages
codeberg-pages
connmanMinimal
connmanctl
coq
coqide
coq_8_14
coqide
coq_8_15
coqide
coq_8_16
coqide
coq_8_17
coqide
coq_8_19
coqide
corundum
corundum
ddnet-server
DDNet
dep-scan
dep-scan
distccWrapper
distcc-links
easyrpg-player
exiflooter
exiflooter
frequest
frequest
gnat-bootstrap
gnat-bootstrap
gnat-bootstrap11
gnat-bootstrap
go2tv-lite
go2tv
go365
Go365
graalvmCEPackages.graalnodejs
js
graalvmCEPackages.graalpy
js
graalvmCEPackages.truffleruby
js
headphones-toolbox
headphones-toolbox
ivpn-service
ivpn
klibcShrunk
klcc
ktls-utils
ktls-utils
lanzaboote-tool
lzbt
libgpg-error
gen-posix-lock-obj
libtransmission
transmission-cli
libtransmission_4
transmission-cli
mkvtoolnix-cli
mkvtoolnix
mumble
mumble-server
mupdf-headless
mupdf
netbird-ui
netbird
nethack-qt
nethack
nethack-x11
nethack
nucleiparser
nparser
nushellPlugins.net
nu-plugin-net
nvmetcfg
nvmetcfg
open-scq30
open-scq30
paralus-cli
paralus
passwdqc
passwdqc
perl536Packages.Swim
swin
perl538Packages.Swim
swin
precice
binprecice
pypy3
pypy
pypy310
pypy
python311Packages.inscriptis
inscript.py
python311Packages.subunit
subunit-diff
python311Packages.uplc
opshin
python312Packages.inscriptis
inscript.py
python312Packages.subunit
subunit-diff
riemann-tools
riemann-tools
rocmPackages.llvm.clang
rocm-llvm-clang
rocmPackages_5.llvm.clang
rocm-llvm-clang
rrsync
rsync
rubyPackages.certified
certified
rubyPackages.cocoapods
cocoapods
rubyPackages.diff-lcs
diff-lcs
rubyPackages.jmespath
jmespath
rubyPackages.paru
paru
rubyPackages.ruby-graphviz
ruby-graphviz
rubyPackages.ruby2ruby
ruby2ruby
rubyPackages.ruby_parser
ruby_parser
rubyPackages.syntax_tree
syntax_tree
rubyPackages.tiny_tds
tiny_tds
rubyPackages_3_2.certified
certified
rubyPackages_3_2.cocoapods
cocoapods
rubyPackages_3_2.diff-lcs
diff-lcs
rubyPackages_3_2.jmespath
jmespath
rubyPackages_3_2.paru
paru
rubyPackages_3_2.ruby-graphviz
ruby-graphviz
rubyPackages_3_2.ruby2ruby
ruby2ruby
rubyPackages_3_2.ruby_parser
ruby_parser
rubyPackages_3_2.syntax_tree
syntax_tree
rubyPackages_3_2.tiny_tds
tiny_tds
rubyPackages_3_3.certified
certified
rubyPackages_3_3.cocoapods
cocoapods
rubyPackages_3_3.diff-lcs
diff-lcs
rubyPackages_3_3.jmespath
jmespath
rubyPackages_3_3.paru
paru
rubyPackages_3_3.ruby-graphviz
ruby-graphviz
rubyPackages_3_3.ruby2ruby
ruby2ruby
rubyPackages_3_3.ruby_parser
ruby_parser
rubyPackages_3_3.syntax_tree
syntax_tree
rubyPackages_3_3.tiny_tds
tiny_tds
rusty-psn-gui
rusty-psn
scss-lint
scss_lint
sensu
sensu
simdutf
simdutf
snowcrash
SNOWCRASH
ssh-copy-id
ssh
synergy
tang
tangd
taskjuggler
taskjuggler
terraform-landscape
terraform_landscape
toluapp
tolua++
topfew
tf
unrar-free
unrar
vial
vial
virtualboxHeadless
VirtualBox
xcode-install
xcode-install
A list can be generated as follows:
which needs to be built as
nix-build -I nixpkgs=channel:nixos-unstable file.nix
so that it can import theprograms.sqlite
file of the channel (as in the above PR, this script is based on the one in https://github.com/NixOS/nixpkgs/issues/219567#issuecomment-1459241963).Quite a number of these seem to be minor variations on a different package (e.g.
ssh-copy-id
,virtualboxHeadless
) which inherit theirmeta
attributes, but change which binaries are available.Two cases even set
mainProgram
to""
, owing to use oflib.optionalString
.