-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meta.mainProgram missing #219567
Comments
I hacked something quick together in an attempt to get a feeling how many packages are affected :) let
pkgs = import <nixpkgs> { };
lib = pkgs.lib;
dbFile = builtins.storePath <nixpkgs/programs.sqlite>;
dbJson = pkgs.runCommand "json" { } ''
${lib.getExe pkgs.sqlite} ${dbFile} '.mode json' '
SELECT package, system, json_group_array(name) AS names
FROM Programs
WHERE system = "x86_64-linux"
GROUP BY package, system;
' > $out
'';
programs = lib.importJSON dbJson;
mainProgram = x: x.meta.mainProgram or (lib.getName x);
exe = e: mainProgram (lib.getAttrFromPath (lib.splitString "." e) pkgs);
in
pkgs.writeText "missing"
(
builtins.toJSON
(lib.filter
(
row:
(lib.filter
(bin: bin == exe row.package)
(builtins.fromJSON row.names)
) == [ ]
)
programs)
)
I expected it to be much worse 😅 Still, too many to fix manually imho :o |
@IndeedNotJames i don't understand the code 😬 does it check if the file Line 136 in 1c0eebb
do you see any chance to automate it? we would at least need to know the actual binary name. then adding it to meta might be possible |
Ah, sorry, will try to outline a few things: My script relies on the It's the same database that helper scripts like My mainProgram = x: x.meta.mainProgram or (lib.getName x); function mimics the I kinda just expected Assuming I didn't misunderstand the c++ and nix code, it still follows the same My script does not differentiate if Take for example {
"names": "[\"ansible-vault\",\"ansible-test\",\"ansible-pull\",\"ansible-playbook\",\"ansible-inventory\",\"ansible-galaxy\",\"ansible-doc\",\"ansible-console\",\"ansible-connection\",\"ansible-config\",\"ansible\"]",
"package": "ansible",
"system": "x86_64-linux"
},
{
"names": "[\"ansible-vault\",\"ansible-test\",\"ansible-pull\",\"ansible-playbook\",\"ansible-inventory\",\"ansible-galaxy\",\"ansible-doc\",\"ansible-console\",\"ansible-connection\",\"ansible-config\",\"ansible\"]",
"package": "ansible_2_12",
"system": "x86_64-linux"
},
{
"names": "[\"ansible-vault\",\"ansible-test\",\"ansible-pull\",\"ansible-playbook\",\"ansible-inventory\",\"ansible-galaxy\",\"ansible-doc\",\"ansible-console\",\"ansible-connection\",\"ansible-config\",\"ansible\"]",
"package": "ansible_2_13",
"system": "x86_64-linux"
} My script lists 3
There are also a lot of
Which seems like a very easy fix to add nixpkgs/pkgs/development/lisp-modules/define-package.nix Lines 114 to 116 in 1c0eebb
I am afraid this response made everything more confusing 😅 But I do strongly agree that some sort of check should be added to borg, nixpkgs-review or whatever. Something that fits in the current workflow, raises awareness.
Some automated way would be awesome, yeah. No idea how to catch all those weird edge cases, though (yet?) But there are also A LOT of packages that just have a single binary in their
Footnotes
|
cc @7c6f434c, @Uthar, @alyssais As said above, I am not familiar with lisp, but would setting And what about
|
Related #246386 |
With #246386 we have eval time warnings instead of build time failures |
For This design choice makes the addition of |
I'm also having this issue:
|
Related: NixOS#219567
Overlay to remove the warning while the generating script is not changed: _: pkgs:
{
xorg = pkgs.xorg // {
xrandr = pkgs.xorg.xrandr.overrideAttrs (_: prev: {
meta = prev.meta // {
mainProgram = "xrandr";
};
});
};
} |
Can be fixed here nixpkgs/pkgs/servers/x11/xorg/overrides.nix Line 978 in 06b25e9
|
Uuu, I didn't see that. Nice. I think having this on the overrides would still be a temporary workaround. I think the script that generates the this file (which I also haven't found) should include the name of everything that is an executable. But if that is not feasible or the cost/benefit doesn't justify than having those are overrides is fine. I'll open a PR for And I notice that I sent the comment on the wrong tab 😅 . At least is on a related issue. |
that no longer seems to be what the warning implies now:
|
Fixed by #297084 |
Describe the bug
For many packages,
nix run
does not work, becausemeta.mainProgram
is missing.Example error:
I don't want to create issues for every case and would prefer a systematic solution.
Please add any package name with this issue here or as comment!
Affected packages:
It would also be nice to add an automatic test if
meta.mainProgram
exist. Maybe it should be added to nixpkgs-review?The text was updated successfully, but these errors were encountered: