-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Tracking issue: superfluous use of pname #277994
Description
There is a huge quantity of appearances of patterns like . . . = pname, . . . = finalAttrs.pname, ${pname} and alike in Nixpkgs.
After some amount of heated discussions 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
pnameas 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).- It can be argued that other attributes change constantly, like the ubiquitous
version.
However, they change based on a familiar modification pattern from the upstream project, whereas things likepnamerarely change.
- It can be argued that other attributes change constantly, like the ubiquitous
-
Related to the point above, this use of pname creates otherwise superfluous in-code dependencies
- This overcomplicates the static reasoning about the code
- This overcomplicates the use of
override*functionalities - The issues above are especially more pronounced in the context of finalAttrs design pattern
-
Sometimes - indeed, most of the time - things like GitHub's
repoand other source origins are not identical topname. Some examples:- OpenMSX and Bochs.
- By convention
pnameis all-lowercase.- An exception consecrated by the use is, curiously, SDL.
- By convention
- In the old times, PIL - the Python Imaging Library - had
pname = pilandsrc.url = ". . ./Imaging-${version}.tar.gz" - Before migration to a dedicated forge, the MIR Project was called Unity-8.
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
- OpenMSX and Bochs.
-
Nix is not a macro language like M4 or the CPP preprocessor.
- Just because two things have the same value, we should not treat them as if they are somehow connected
- Just because two things are somehow connected, this connection should not necessarily be converted into the code
- Pushing to the absurd and linking to the point above, it would be insane to parameterize each occurrence of
pname.
References: