-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
kana: init at 1.4 #292120
kana: init at 1.4 #292120
Conversation
domain = "gitlab.gnome.org"; | ||
owner = "fkinoshita"; | ||
repo = "Kana"; | ||
rev = "v${version}"; |
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.
rev = "v${version}"; | |
rev = "v${finalAttrs.version}"; |
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.
what is the actual advantage of this? it's not like overriding version
will work properly, since all the fetchers are fixed-output
in fact, this could even cause a derivation to build fine on one system, but fail on another (i've had this happen when updating packages and forgetting to invalidate the source hash, this could be extremely confusing to less technical users who haven't touched the inside of nixpkgs)
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.
what is the actual advantage of this?
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.
but the only problem with rec
that page mentions is the possibility for infinite recursion, which is equally possible with the finalAttrs pattern.
i asked what the advantage of getting rid of rec
is, and you gave me quite a recursive answer.
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.
finalAttrs
is preferable in cases where attributes of the derivation are actually used within the derivation - here the only places where it's used are in src
and cargoDeps
, which doesn't really save much effort when someone goes to override.
And this specific usage is at least somewhat contentious: see #293452 (comment)
I do not consider this worth blocking a review on.
gst-plugins-good | ||
]); | ||
|
||
meta = with lib; { |
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.
meta = with lib; { | |
meta = { |
Nested with is bad.
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.
I know nested with is bad, but the only thing that is nested here is the name of the maintainer, while writing "lib" everywhere is very ugly. And this is almost a convention in nixpkgs.
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.
And this is almost a convention in nixpkgs.
- You was complaining about finalAttrs not being written convention or enforced guideline, but now you are arguing about
with lib;
being a consuetudinary convention and enforcing it? Please be consistent. - Tracking issue: remove overuses of
with lib;
#208242
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.
You was complaining about finalAttrs not being written convention or enforced guideline, but now you are arguing about
with lib;
being a consuetudinary convention and enforcing it? Please be consistent.
No, my request was consistent actually: I'm requesting a formal discussion about whether a particular format or feature should be adopted, and a documentation change indicating the best practice to follow (I know there is one waiting to be merged now). (And, if possible, automatically suggested changes by CI.) Before that, I'm always going to follow the common practice in Nixpkgs, which I've always found clean and easy, but I'm not going to debate if that's the best practice.
I have long found that following some suggestions of newer modifications can be a problem: for example, when adding environment variables, although some committers think that we should always prefer env.XXX
, there are also commiters suggesting me to remove the leading env
. This concern also affects my opinion of this suggested change, because I have added more than 30 packages in the past year, but this is the first time I have received this request, and after receiving this request, my other PRs submitted at the same time still passed the review. So I doubt the progress of committers' discussions on these issues.
Besides that, yes, the changes are good to go and applying them doesn't seem to introduce new problems for me.
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.
No, my request was consistent actually: I'm requesting a formal discussion about whether a particular format or feature should be adopted, and a documentation change indicating the best practice to follow (I know there is one waiting to be merged now).
Since nix.dev is NixOS-blessed documentation, their best pratices advices are authoritative, even if not vinculative.
Given the above,
- finalAttrs gets rid of rec, and getting rid of rec is one of best practices
- indeed finalAttrs is documented in the NixOS stdenv docs, have you read about it?
- no nested with aligns with avoiding
with
I have long found that following some suggestions of newer modifications can be a problem: for example, when adding environment variables, although some committers think that we should always prefer env.XXX, there are also commiters suggesting me to remove the leading env.
Currently, attributes not recognized by (say) stdenv.mkDerivation are treated as environment vars to the shell.
It can bring problematic issues, like "oh, i wrote propBuildInputs instead of propagatedBuildInputs, and this bug goes undetected".
By using env you are explicitly saying this is an environment variable.
Indeed this is one of examples given by dream2nix project to use NixOS-like modules:
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.
Since nix.dev is NixOS-blessed documentation, their best pratices advices are authoritative
Nothing in the nix.dev link indicates that meta = with lib;
is unacceptable - that's a separate case from with lib;
at the top of a file.
I do not consider this worth blocking a review on.
attributes not recognized by (say) stdenv.mkDerivation are treated as environment vars to the shell
Nit: basically all attributes are treated as envvars.
By using env you are explicitly saying this is an environment variable.
Agreed, the point of env
is to be explicit about intention. If an attribute's purpose is to be used as an envvar and not a builder arg, then it should use env
.
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.
Nothing in the nix.dev link indicates that
meta = with lib;
is unacceptable - that's a separate case fromwith lib;
at the top of a file.
with lib;
around meta set invariably bring the issue of nested with
.
The most typical usage is something like
meta = with lib; {
maintainers = with maintainers; . . . ;
platforms = with platforms; . . . ;
}
And the nix.dev link says, among other things:
When more than one with used, it’s not clear anymore where the names are coming from.
Therefore, I believe that avoiding instances of meta = with lib;
are worth removing and is in line with the arguments of that link.
Further, removing nested with
and restricting with
to single-line expressions is more manageable than removing with
unconditionally, therefore being a good compromise.
I do not consider this worth blocking a review on.
Neither I.
But I will blame GitHub: it has no such a thing as a "yellow" unblocking review.
On the other hand, I have no power to block a PR indefinitely.
maintainers = with maintainers; [ aleksana ]; | ||
platforms = platforms.unix; |
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.
maintainers = with maintainers; [ aleksana ]; | |
platforms = platforms.unix; | |
maintainers = with lib.maintainers; [ aleksana ]; | |
platforms = lib.platforms.unix; |
maintainers = with maintainers; [ aleksana ]; | ||
platforms = platforms.unix; | ||
}; | ||
} |
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.
} | |
}) |
tested, the built application works fine :) |
82b7d1a
to
48d80b8
Compare
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.
Break it on Darwin.
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.
Builds and runs. Thanks for the contribution!
Regarding the other reviewer feedback:
- There's currently no consensus to remove
meta = with lib;
finalAttrs
without some usage of said attrs outside ofsrc
or other FOD-related construct is also contentious- If we establish consensus, this can be addressed with a treewide change rather than blocking a package PR over it
domain = "gitlab.gnome.org"; | ||
owner = "fkinoshita"; | ||
repo = "Kana"; | ||
rev = "v${version}"; |
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.
finalAttrs
is preferable in cases where attributes of the derivation are actually used within the derivation - here the only places where it's used are in src
and cargoDeps
, which doesn't really save much effort when someone goes to override.
And this specific usage is at least somewhat contentious: see #293452 (comment)
I do not consider this worth blocking a review on.
gst-plugins-good | ||
]); | ||
|
||
meta = with lib; { |
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.
Since nix.dev is NixOS-blessed documentation, their best pratices advices are authoritative
Nothing in the nix.dev link indicates that meta = with lib;
is unacceptable - that's a separate case from with lib;
at the top of a file.
I do not consider this worth blocking a review on.
attributes not recognized by (say) stdenv.mkDerivation are treated as environment vars to the shell
Nit: basically all attributes are treated as envvars.
By using env you are explicitly saying this is an environment variable.
Agreed, the point of env
is to be explicit about intention. If an attribute's purpose is to be used as an envvar and not a builder arg, then it should use env
.
Description of changes
just for fun
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.