-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Add exe attribute to packages #158461
Add exe attribute to packages #158461
Conversation
The "spine" of the package attrset had to evaluate passthru, which makes it overly strict.
I always interpreted |
When I should also note that |
Wouldn't there be a lot of duplication for not a lot of gain? Shouldn't we set |
It seems better to me to have a function that returns the main program for a package, rather than pollute the attribute namespace of every package with a magic attribute. I.e. I'd prefer |
I am well aware and I agree that we shouldn't add attributes lightly, though we have to consider: In my view, the brevity is worth it. |
It's not so much about the brevity of |
Derivations that define a regular `exe` attribute but not a `meta.mainProgram` will behave exactly the same again.
That wasn't quite the case. Defining the attr worked just fine and I've updated the solution so it can be read back as an attribute as well.
Allocations are up by 0.45%. Final heap size is up by a slightly higher amount of approximately 0.7% (it gets rounded). CPU time is too noisy in the evaluation report. It shows an "improvement" in the previous report, but total allocations are a more usable proxy for time, so probably also near 0.45%. See https://github.com/NixOS/nixpkgs/pull/158461/checks?check_run_id=5092093463 or latest report in the commit statuses.
I agree that we should only do it for very few; certainly not every derived value.
In absolute terms, yes there would, but it is not a maintenance hazard. |
Motivation for this change
Adds an
exe
attribute as a shorthand for the main executable of a package.Closes #138418
Things done
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/
)nixos/doc/manual/md-to-db.sh
to update generated release notes