Error: flake 'path:/etc/nixos' does not provide attribute

hello, I recently tried out flake to install gstreamer.

I followed the guide found here

I created a flake.nix file under /etc/nixos/ and copy the whole thing from that guide in, which looks like this:

# file: flake.nix
{
  description = "A GStreamer development flake";

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      devShells.${system}.default = pkgs.mkShell {
        buildInputs = with pkgs; [
          # Video/Audio data composition framework tools like "gst-inspect", "gst-launch" ...
          gst_all_1.gstreamer
          # Common plugins like "filesrc" to combine within e.g. gst-launch
          gst_all_1.gst-plugins-base
          # Specialized plugins separated by quality
          gst_all_1.gst-plugins-good
          gst_all_1.gst-plugins-bad
          gst_all_1.gst-plugins-ugly
          # Plugins to reuse ffmpeg to play almost every video format
          gst_all_1.gst-libav
          # Support the Video Audio (Hardware) Acceleration API
          gst_all_1.gst-vaapi
          #...
        ];
      };
    };
}

then i did nix develop command to install GStreamer

but when i rebuild my system with nixos-rebuild switch, it throws me an error:

error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."Windows11".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."Windows11".config.system.build.nixos-rebuild' or 'nixosConfigurations."Windows11".config.system.build.nixos-rebuild'

It feels like I’m missing something obvious here and i hope someone can please help me

That flake defines a devShell, which is activated by nix develop and is meant to be a temporary environment for development. It does not provide a NixOS system configuration. The NixOS configuration is usually the wrong place to put development libraries anyway.