Switching from 24.11 to unstable declaratively (without channels)

@tlater I dont use flakes (yet) and tried using channels with no success. So no reason for such annoyed comments.

I have read the comment in the config now and it makes sense. I have changed that back to the initial 24.11 and added the unstable channel as per the docs

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

I realized there was an identical channel called nixos-unstable which I then removed and updated the channels.

I try to rebuild my system with the same error

      error: undefined variable 'nix-index-database'
       at /etc/nixos/configuration/packages.nix:57:9:
           56|         nix-index
           57|         nix-index-database #only in unstable
             |         ^
           58|         home-manager

I am thinking about switching my system to flakes, but until then I would like to make this work?

I have already setup a flake.nix

{
  description = "General Flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  };

  outputs = { self, nixpkgs, ... }@inputs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./configuration.nix
      ];
    };
  };
}

It seems that here I can set a different input URL declaratively. But rebuilding the system still shows the undefined packages, even though the only channel is the unstable channel, and the input is unstable??

I removed the channel, still the same issue. The package only in unstable is not found.