Nix shell and rebuild not including packages on search.nix

I tried to install the intelephense package with nix-shell

nix-shell -p intelephense
error:
       … while calling the 'derivationStrict' builtin

         at /builtin/derivation.nix:9:12: (source not available)

       … while evaluating derivation 'shell'
         whose name attribute is located at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/stdenv/generic/make-derivation.nix:333:7

       … while evaluating attribute 'buildInputs' of derivation 'shell'

         at /nix/var/nix/profiles/per-user/root/channels/nixos/pkgs/stdenv/generic/make-derivation.nix:380:7:

          379|       depsHostHost                = elemAt (elemAt dependencies 1) 0;
          380|       buildInputs                 = elemAt (elemAt dependencies 1) 1;
             |       ^
          381|       depsTargetTarget            = elemAt (elemAt dependencies 2) 0;

       error: undefined variable 'intelephense'

       at «string»:1:107:

            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (intelephense) ]; } ""

This error occurs even when intelephense is available here: NixOS Search

My system.stateVersion is 24.05

I would appreciate any help, thank you!

stateVersion is irrelevant.
What channel are you using? What’s the output of nix-channel --list and sudo nix-channel --list? Are you on NixOS or some other distro/mac?

nix-channel --list does not output anything
sudo nix-channel --list outputs nixos https://nixos.org/channels/nixos-24.05
I’m on NixOS

Then you should change your root user’s nixos channel from nixos-24.05 (which was end-of-life last month, by the way) to nixos-24.11:

sudo nix-channel --add https://nixos.org/channels/nixos-24.11 nixos
sudo nix-channel --update

Then you can try your nix-shell command again, and it would work.
Of course, I would also recommend rebuilding your NixOS config soon after (read the release notes as well, if you’re stuck) with sudo nixos-rebuild boot, and then reboot your machine, so that your programs are up-to-date.

You should generally try to update your system relatively frequently, to ensure that you get security updates and such. Switching channels should be done on a 6-month cadence as releases are done on that same cadence (every May and November, at the end of the month).

Thank you so very much. I appreciate that a lot