-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
lib: add lib.getExe' function #247115
lib: add lib.getExe' function #247115
Conversation
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/lib-getexe-best-practices-discussion-thread/31290/1 |
getExe' pkgs.mustache-go | ||
=> "/nix/store/am9ml4f4ywvivxnkiaqwr0hyxka1xjsf-mustache-go-1.3.0/bin/mustache" | ||
*/ | ||
getExe' = x: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternative name:
getExe' = x: | |
guessExe = x: |
Not ready to be merged, needs to be exposed in |
After not sure how many years I may only now find out about this feature:
Whenever stringifying derivation it results in I would like some confirmation on this but I don't think that I have much of a use for the current implementation of |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/lib-getexe-best-practices-discussion-thread/31290/3 |
I believe this is because nixpkgs/pkgs/desktops/plasma-5/oxygen.nix Line 38 in 66aedfd
nix-repl> toString tzdata
"/nix/store/hwdckdgh3y73qravhmx7dmkv825zbipi-tzdata-2023c"
nix-repl> tzdata ? bin
true |
See also #248895 |
Description of changes
We need this function to encourage the efficiency of build artifacts. Issues with alternatives:
lib.getExe
: Throws a warning on the majority of packages due to lack ofmeta.mainProgram
. I consider it useless at this point.(View comment below)"${lib.getBin pkgs.something}/bin/something
: Verbose, nobody is going to bother checking if package hasbin
output"${pkgs.something}/bin/something
:In case of derivations with multiple outputs is less space efficient(View comment below)Ideal implementation
While I do realize issues that may come up with old implementation of
lib.getExe
, I think we gain more from having it than from removing it. I think ideally we should revert the patch which addsbuiltins.trace
onlib.getExe
and encourage usage of this functionI am okay with leaving
lib.getExe
as it is right now, but for that, I'd like formeta.mainProgram
to be a required attribute on almost all derivationsAlternative implementation
Someone needs to go over the packages and implement `meta.mainProgram where it is appropriate
Things done
Copied old implementation of
lib.getExe
and named itlib.getExe'
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)