NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.21k stars 14.21k forks source link

trace: warning while doing nix-env -u #306276

Open Aviksaikat opened 7 months ago

Aviksaikat commented 7 months ago

Describe the bug

Getting the following trace warning while doing nix-env -u

$ nix-env -u                                                                   
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: eww now can build for X11 and wayland simultaneously, so `eww-wayland` is deprecated, use the normal `eww` package instead.
trace: warning: lxd has been renamed to lxd-lts
trace: warning: lxd-unwrapped has been renamed to lxd-unwrapped-lts
trace: warning: nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which is currently available as nixfmt-rfc-style
trace: warning: nvtop has been renamed to nvtopPackages.full
trace: warning: nvtop-amd has been renamed to nvtopPackages.amd
trace: warning: nvtop-intel has been renamed to nvtopPackages.intel
trace: warning: nvtop-msm has been renamed to nvtopPackages.msm
trace: warning: nvtop-nvidia has been renamed to nvtopPackages.nvidia
trace: warning: writeReferencesToFile is deprecated in favour of writeClosure

Steps To Reproduce

  1. Do nix-env -u

Expected behavior

A clear and concise description of what you expected to happen.

nix-env --version output

nix-env (Nix) 2.21.2

Additional context

OS: Kali GNU/Linux 2024.1

Priorities

Add :+1: to issues you find important.

colinrozzi commented 7 months ago

I am getting the same error on Debian GNU/Linux 11 (bullseye).

I have a fresh install of both debian and nix, and whenever I run nix-env -i with any package, I get the first 9 lines of the above error, every one starting with cudaPackages.

kakig commented 7 months ago

I'm also getting the same trace warnings with nix 2.21.2 running in Red Hat Enterprise Linux 9.3 (Plow), single user installation (--no-daemon)

tuanpham96 commented 7 months ago

I'm getting similar warnings with nix 2.21.2 on Ubuntu 20.04 LTS.

thufschmitt commented 6 months ago

These are Nixpkgs warnings that get triggered on recent nixos-unstable versions. I'm not sure why they suddently started popping-up, but the root cause lies in Nixpkgs itself. Moving the issue there as a consequence.

For more context: I can reproduce this with any reasonable Nix version on nixos-unstable. nixos-23.11 doesn't exhibit this.

$ nix-env -f channel:nixos-23.11 -u
$ nix-env -f channel:nixos-unstable -u
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoAddOpenGLRunpathHook is deprecated, use pkgs.autoAddDriverRunpath instead
trace: warning: cudaPackages.autoFixElfFiles is deprecated, use pkgs.autoFixElfFiles instead
trace: warning: eww now can build for X11 and wayland simultaneously, so `eww-wayland` is deprecated, use the normal `eww` package instead.
trace: warning: lxd has been renamed to lxd-lts
trace: warning: lxd-unwrapped has been renamed to lxd-unwrapped-lts
trace: warning: nixfmt was renamed to nixfmt-classic. The nixfmt attribute may be used for the new RFC 166-style formatter in the future, which is currently available as nixfmt-rfc-style
trace: warning: nvtop has been renamed to nvtopPackages.full
trace: warning: nvtop-amd has been renamed to nvtopPackages.amd
trace: warning: nvtop-intel has been renamed to nvtopPackages.intel
trace: warning: nvtop-msm has been renamed to nvtopPackages.msm
trace: warning: nvtop-nvidia has been renamed to nvtopPackages.nvidia
trace: warning: writeReferencesToFile is deprecated in favour of writeClosure
infinisil commented 6 months ago

This is caused by some packages starting to use lib.warn for deprecations: https://github.com/NixOS/nixpkgs/blob/e5d9b197e9f13b29ca797e6a0aab21840eab64d4/pkgs/top-level/aliases.nix#L777

philiptaron commented 5 months ago

I wonder whether we should encourage this. Given the UX downsides, I lean towards "no".

ManInDark commented 5 months ago

I'd like to add that messages are also displayed multiple times, so I've got e.g. trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead thrice (I couldn't see any correlation from number of messages to number of packages).

Setup:

nixos-discourse commented 5 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-introduce-a-breaking-version-bump/46746/9

kittygirlyy commented 4 months ago

I got the same...

goyalyashpal commented 3 months ago

as far as i can recall, i started seeing this only after i added the nvtopPackages.nvidia in my etc/**/configuration.nix file.

$ sudo nixos-rebuild test
building Nix...
building the system configuration...
trace: warning: cudaPackages.autoAddDriverRunpath is deprecated, use pkgs.autoAddDriverRunpath instead
stopping the following units: accounts-daemon.service
$ nix-shell --version
nix-shell (Nix) 2.18.2

$ nix-info
system: "x86_64-linux", 
multi-user?: yes, 
version: nix-env (Nix) 2.18.2, 
nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
roberth commented 2 months ago

This is caused by some packages starting to use lib.warn for deprecations:

https://github.com/NixOS/nixpkgs/blob/e5d9b197e9f13b29ca797e6a0aab21840eab64d4/pkgs/top-level/aliases.nix#L777

What if they did something like the following?

  lxd = pkgs.lxd-lts // { outPath = lib.warn "lxd has been renamed to lxd-lts" lxd-lts.outPath; }

This doesn't cover everything; this should probably be handled by a function that adds it to all the outputs, so that a warning is emitted on instantiation, and not on attributes like name, version, type and meta.

nixos-discourse commented 2 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2024-08-21-nix-team-meeting-minutes-171/50950/1