You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
meta.position specification is not overridable via <pkg>.overrideAttrs overriding #295907
According to Nix Manual and the stdenv.mkDerivation source, meta.position is specified by stdenv.mkDerivation according to several attributes of the package.
As meta.position is also used to update packages automatically, it is sometimes necessary to specify/override with a canonical value. A real-world example can be found in #295828. However, such overriding via <pkg>.overrideAttrs provided by stdenv.mkDerivation seems simply discarded.
Steps To Reproduce
$ nix repl
Welcome to Nix 2.18.1. Type :? for help.
nix-repl> pkgs = import ./. { }
nix-repl> pkgs.hello.meta.position
"/home/shamrock/Projects/NixOS/nixpkgs_timeshift/pkgs/by-name/he/hello/package.nix:34"
nix-repl> pkgs.cowsay.meta.position
"/home/shamrock/Projects/NixOS/nixpkgs_timeshift/pkgs/tools/misc/cowsay/default.nix:46"
nix-repl> (pkgs.hello.overrideAttrs (previousAttrs: { meta = previousAttrs.meta // { position = pkgs.cowsay.meta.position; }; })).meta.position
"/home/shamrock/Projects/NixOS/nixpkgs_timeshift/pkgs/by-name/he/hello/package.nix:34"
Or nix eval --impure --expr "let pkgs = import ./. { }; in (pkgs.hello.overrideAttrs (previousAttrs: { meta = previousAttrs.meta // { position = pkgs.cowsay.meta.position; }; })).meta.position"
Expected behavior
The meta.position attribute be overridable with <pkg>.overrideAttrs, i.e.
$ nix eval --impure --expr "let pkgs = import ./. { }; in (pkgs.hello.overrideAttrs (previousAttrs: { meta = previousAttrs.meta // { position = pkgs.cowsay.meta.position; }; })).meta.position == pkgs.cowsay.meta.position"
true
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Notify maintainers
Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"output here
changed the title [-]`meta.position` is not overridable by `<pkg>.overrideAttrs`[/-][+]`meta.position` specification is lost after `<pkg>.overrideAttrs` overriding[/+]on Mar 14, 2024
changed the title [-]`meta.position` specification is lost after `<pkg>.overrideAttrs` overriding[/-][+]`meta.position` specification is not overridable via `<pkg>.overrideAttrs` overriding[/+]on Mar 14, 2024
I think this can be closed because overriding pos is the answer, right?
To be honest, I think we should've used pos from the start instead of meta.position. It is just something that I don't think should be put in meta. Also meta.mainProgram should also not be put in meta.
And the attr pos of meta.maintainers may be a better default value of pos?
And the attr pos of meta.maintainers may be a better default value of pos?
That would require a massive refactor as packages now rely on the current behavior. Also, a fair number of packages don't have a maintainer, but nearly all should have a description.
Those without maintainers can fall back to descriptions. There is already meta.maintainersPosition. How many packages actually has meta.maintainersPosition set and being different from meta.position?
Activity
[-]`meta.position` is not overridable by `<pkg>.overrideAttrs`[/-][+]`meta.position` specification is lost after `<pkg>.overrideAttrs` overriding[/+][-]`meta.position` specification is lost after `<pkg>.overrideAttrs` overriding[/-][+]`meta.position` specification is not overridable via `<pkg>.overrideAttrs` overriding[/+]wolfgangwalther commentedon Jun 16, 2025
You can override the position with
pos:But it's a bit annoying, because you'd have to replicate the logic in
mkDerivationto get to the actualmeta.positionofcowsay.UlyssesZh commentedon Mar 30, 2026
I think this can be closed because overriding
posis the answer, right?To be honest, I think we should've used
posfrom the start instead ofmeta.position. It is just something that I don't think should be put inmeta. Alsometa.mainProgramshould also not be put inmeta.And the attr pos of
meta.maintainersmay be a better default value ofpos?eclairevoyant commentedon Mar 30, 2026
That would require a massive refactor as packages now rely on the current behavior. Also, a fair number of packages don't have a maintainer, but nearly all should have a description.
UlyssesZh commentedon Mar 30, 2026
Those without maintainers can fall back to descriptions. There is already
meta.maintainersPosition. How many packages actually hasmeta.maintainersPositionset and being different frommeta.position?