Description
Describe the bug
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
Add a 👍 reaction to issues you find important.