lib/meta: add getExe to get the main program of a drv#167247
Merged
Artturin merged 1 commit intoNixOS:masterfrom Apr 26, 2022
Merged
lib/meta: add getExe to get the main program of a drv#167247Artturin merged 1 commit intoNixOS:masterfrom
Artturin merged 1 commit intoNixOS:masterfrom
Conversation
Member
|
Duplicate of #138418 |
6 tasks
007ec62 to
939caff
Compare
Member
Author
|
alright there's 3 choices now A fourth option would be based on the comment by @roberth #138418 (comment) |
071e49d to
861a862
Compare
861a862 to
379b9c8
Compare
roberth
approved these changes
Apr 24, 2022
13 tasks
roberth
reviewed
Jul 31, 2023
| => "/nix/store/am9ml4f4ywvivxnkiaqwr0hyxka1xjsf-mustache-go-1.3.0/bin/mustache" | ||
| */ | ||
| getExe = x: | ||
| "${lib.getBin x}/bin/${x.meta.mainProgram or (lib.getName x)}"; |
Member
There was a problem hiding this comment.
Having second thoughts about the lib.getName x part.
- A package should make its main program explicit. Explicit is good.
- When
/bin/${name}does not exist, the error is delayed until runtime, and most likely the caller won't know why/bin/foo, which doesn't exist, was ever accessed. Especially if they didn't make the call togetExethemselves; for example when a NixOS option does it for them.
Should we make meta.mainProgram mandatory for getExe? I think we should!
Member
There was a problem hiding this comment.
Or at least we could warn about it.
Member
Author
There was a problem hiding this comment.
It'll have to be a warning for at least a release as this is already used widely outside of nixpkgs
Member
There was a problem hiding this comment.
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes
add a way to get the main program of a derivation
Closes #137032
Alternative to #158461
based on a comment by @edolstra
hopefully this at least unstalls #158461
Things done
sandbox = trueset 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/)nixos/doc/manual/md-to-db.shto update generated release notes