Skip to content
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

[Tracking] Review package examples from manual #253291

Open
9 tasks
davidak opened this issue Sep 4, 2023 · 8 comments
Open
9 tasks

[Tracking] Review package examples from manual #253291

davidak opened this issue Sep 4, 2023 · 8 comments
Assignees
Labels
0.kind: bug Something is broken 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: best practices 6.topic: documentation Meta-discussion about documentation and its workflow

Comments

@davidak davidak added 0.kind: bug Something is broken 6.topic: best practices 6.topic: documentation Meta-discussion about documentation and its workflow labels Sep 4, 2023
@mibmo
Copy link
Contributor

mibmo commented Sep 4, 2023

Most of them are using rec instead of the finalAttrs pattern (I'm not sure what it's formally called), see

stdenv.mkDerivation rec {

stdenv.mkDerivation (finalAttrs: {

Seems that they aren't run through a formatter either.

I'm by no means an expert, but the first one looks good to me (except the sha256 instead of hash). :)

@mjarosie
Copy link

Additionally, GNU Hello package was deleted or moved, so the first link shows 404 error.

@mibmo mibmo self-assigned this Oct 24, 2023
@rjpcasalino
Copy link
Contributor

rjpcasalino commented Nov 16, 2023

@mjarosie the unstable nixpkgs manual has moved the docs to a new location the hello example is here now pkgs/by-name/he/hello/package.nix - I assume the unstable nixpkgs manual rolls out later this month

@fricklerhandwerk fricklerhandwerk changed the title Review package examples from manual [Tracking] Review package examples from manual Apr 9, 2024
@samueldr samueldr added the 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems label Apr 23, 2024
@doronbehar
Copy link
Contributor

doronbehar commented Jul 27, 2024

I read today this part of our docs:

https://nixos.org/manual/nixpkgs/unstable/#mkderivation-recursive-attributes

And it is not stated firmly whether using a function as an mkDerivation argument is better then the old rec {} option. I was wondering if that's intentional, and whether there are reasons not to use a function as an mkDerivation argument. I was pretty sure until I read this part that there is a strong consensus in favor of using finalAttrs: instead of rec {}... cc @roberth as the main pusher of the finalAttrs: pattern.

@nbraud
Copy link
Contributor

nbraud commented Sep 16, 2024

I was pretty sure until I read this part that there is a strong consensus in favor of using mkDerivation...

Don't both use mkDerivation? Could you clarify, @doronbehar ?

@doronbehar
Copy link
Contributor

I was pretty sure until I read this part that there is a strong consensus in favor of using mkDerivation...

Don't both use mkDerivation? Could you clarify, @doronbehar ?

You are right, I wasn't clear, that "mkderivation..." should have been "finalAttrs:..." I edited that comment...

@nbraud nbraud mentioned this issue Sep 16, 2024
6 tasks
@nbraud
Copy link
Contributor

nbraud commented Sep 17, 2024

Most of them are using rec instead of the finalAttrs pattern (I'm not sure what it's formally called), see

For what it's worth, I think part of the problem is that many builders still do not support explicitly-recursive attrsets.

#234651 introduces helpers which would make it much easier to support the pattern in all builders, FWIW

@mibmo
Copy link
Contributor

mibmo commented Sep 18, 2024

Most of them are using rec instead of the finalAttrs pattern (I'm not sure what it's formally called), see

For what it's worth, I think part of the problem is that many builders still do not support explicitly-recursive attrsets.

#234651 introduces helpers which would make it much easier to support the pattern in all builders, FWIW

It's worth considering the eval time impact to nixpkgs as a whole too. I don't quite remember where, but I vaguely recall reading that a not-insignificant portion of the eval time is from derivations utilizing the finalAttrs pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken 5. scope: tracking Long-lived issue tracking long-term fixes or multiple sub-problems 6.topic: best practices 6.topic: documentation Meta-discussion about documentation and its workflow
Projects
None yet
Development

No branches or pull requests

7 participants