-
-
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
Tracking issue: superfluous use of pname
#277994
Comments
Why? If we are using I also want to list some counter reasons:
|
If there's a typing error, it will fail at buildtime anyway. And I do find 61 examples of the objectively worse |
Because it is just the round I. I can include them later.
Many thanks to provide even more examples for
Not all connections need to be or should be encoded.
Neither Nixpkgs is bound by GitHub nor the world of source forges. Just look at the fetchers we have. Further, there are many other contexts in which we can't assume the URLs are case-insensitive.
The examples you provided are not expected to change in a long term. Hardcoding them brings no harm, even for the Mousepad users. Further, pushing it a bit far, e.g. interpolating every appearance of What about Bochs? Should we interpolate it like pname = "bochs";
repoOwner = pname + "-emu";
repoName =
let
splitted = builtins.match "(.)(.*)" pname;
in
concatStringsSep "" (singleton (toUpper (head splitted)) ++ (tail splitted)); Remembering that the string "Bochs" appears on the |
They definitely should be fixed.
Of course they shouldn't. As you said, don't make it a macro language, interpolating My point is
I agree. |
Ideally the Nowadays the finalAttrs design pattern was implemented only for stdenv.mkDerivation, but ideally it should be the standard - and then all appearances of It looks for yet another reason to get rid of both |
Don't introduce another |
This has been a pet peeve of mine for a long time, so I for one would like to say thank you for moving this ahead! |
This is discouraged. See NixOS#277994.
This is discouraged. See NixOS#277994.
This is discouraged. See NixOS#277994.
This is discouraged. See NixOS#277994.
There is a huge quantity of appearances of patterns like
. . . = pname
,. . . = finalAttrs.pname
,${pname}
and alike in Nixpkgs.After some amount of
heateddiscussions with @SuperSandro2000, I come to the conclusion that this should be discouraged.There are some reasons I can enumerate for it:
Many, if not all, appearances of
pname
as an rvalue are basically constants - indeed they are constants since Nix is a functional language. They can be hardcoded with no loss (and some very small performance gains since the compiler will not need to consult the symbol tables).version
.However, they change based on a familiar modification pattern from the upstream project, whereas things like
pname
rarely change.Related to the point above, this use of pname creates otherwise superfluous in-code dependencies
override*
functionalitiesSometimes - indeed, most of the time - things like GitHub's
repo
and other source origins are not identical topname
. Some examples:pname
is all-lowercase.pname = pil
andsrc.url = ". . ./Imaging-${version}.tar.gz"
After being passed from Canonical to the community, it was renamed Lomiri, but the forge did not change his name. Indeed the old, now-frozen repo is still called https://github.com/ubports/unity8.
Now it lives over https://gitlab.com/ubports/development/core/lomiri
Nix is not a macro language like M4 or the CPP preprocessor.
pname
.References:
The text was updated successfully, but these errors were encountered: