With nixos-rebuild, how can I see what pulls in a certain package?

Somehow, somewhere in my config files, I request something that requests youtube-dl

How can I see the statement that causes all of this?

I’ve searched through my config files and I find no mention of youtube.

building Nix...
building the system configuration...
trace: warning: The option `services.xserver.xkbVariant' defined in `/home/b0ef/ds/platform/conf/etc.nixos.xorg.nix' has been renamed to `services.xserver.xkb.variant'.
trace: warning: The option `services.xserver.layout' defined in `/home/b0ef/ds/platform/conf/etc.nixos.xorg.nix' has been renamed to `services.xserver.xkb.layout'.
trace: warning: The option `services.xserver.displayManager.sddm.enable' defined in `/home/b0ef/ds/platform/conf/etc.nixos.xorg.nix' has been renamed to `services.displayManager.sddm.enable'.
trace: warning: The option `services.xserver.displayManager.defaultSession' defined in `/home/b0ef/ds/platform/conf/etc.nixos.xorg.nix' has been renamed to `services.displayManager.defaultSession'.
trace: warning: The option `services.locate.locate' defined in `/home/b0ef/ds/platform/conf/hydra.platform.nix' has been renamed to `services.locate.package'.
trace: warning: The option `fonts.fonts' defined in `/home/b0ef/ds/platform/conf/hydra.platform.nix' has been renamed to `fonts.packages'.
error:
       … while calling the 'head' builtin

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: Package ‘python3.11-youtube-dl-2021.12.17’ in /nix/store/57znqz6cbirgabqvd3ha4pmghqajnc6q-nixos-24.05/nixos/pkgs/tools/misc/youtube-dl/default.nix:84 is marked as insecure, refusing to evaluate.


       Known issues:
        - youtube-dl is unmaintained, migrate to yt-dlp, if possible

       You can install it anyway by allowing this package, using the
       following methods:

       a) To temporarily allow all insecure packages, you can use an environment
          variable for a single invocation of the nix tools:

            $ export NIXPKGS_ALLOW_INSECURE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) for `nixos-rebuild` you can add ‘python3.11-youtube-dl-2021.12.17’ to
          `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
          like so:

            {
              nixpkgs.config.permittedInsecurePackages = [
                "python3.11-youtube-dl-2021.12.17"
              ];
            }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
          ‘python3.11-youtube-dl-2021.12.17’ to `permittedInsecurePackages` in
          ~/.config/nixpkgs/config.nix, like so:

            {
              permittedInsecurePackages = [
                "python3.11-youtube-dl-2021.12.17"
              ];
            }

--show-trace.​​​​​​​​​​​

1 Like

Thank you. I had used that switch before, but forgotten about it;)
The culpris was ytui-music, some app I’ve never used, but I’ll check it out someday