{ self, inputs, ... }: {
  flake.nixosModules."14900kConfiguration" =
    { self, config, pkgs, ... }:
    {
      imports = [
        self.nixosModules."14900kHardware"
        inputs.home-manager.nixosModules.home-manager
        inputs.sops-nix.nixosModules.sops
        inputs.nixvirt.nixosModules.default

        self.nixosModules.system
        self.nixosModules.desktop
        self.nixosModules.users

        self.nixosModules."client-services"
        ./_private/platform.nix
        ./_private/nvidia.nix
        ./_private/gpu-passthru.nix
        ./_private/peripherals.nix
        # ./_private/printing-epson.nix
        ./_private/displays.nix
        ./_private/streaming-display.nix
        ./_private/ai.nix
        ./_private/media-disk.nix
        ./_private/jellyfin-nfs-export.nix
        ./_private/moonfin-flatpak.nix
      ];

     services.cloudflare-warp.enable = true;
     programs.nix-ld.enable = true;

      boot.kernel.sysctl."fs.inotify.max_user_watches" = 1048576;
      boot.kernel.sysctl."fs.inotify.max_user_instances" = 2048;

      # Intel iGPU video acceleration (VA-API / QSV via oneVPL).
      # This fixes common NixOS issues like `vaInitialize failed` and missing QSV encoders in apps.
      hardware.graphics = {
        enable = true;
        enable32Bit = true; # Required by Wine/DXVK for 32-bit Vulkan userspace.
        extraPackages = with pkgs; [
          intel-media-driver # iHD (Gen8+)
          vpl-gpu-rt # oneVPL runtime (QSV)
          libvdpau-va-gl
        ];
      };

      environment.sessionVariables = {
        LIBVA_DRIVER_NAME = "iHD";
        # Force VA-API to use the Intel iGPU render node (otherwise libva may pick NVIDIA and iHD fails).
        LIBVA_DRM_DEVICE = "/dev/dri/renderD128";
      };


      chiasson.desktop = {
        niri.enable = true;
        defaultSession = "niri";
        shell = "dms";
        shells.dms = {
          rebuildCommand = [
            "sudo"
            "nixos-rebuild"
            "switch"
            "--flake"
            ".#14900k"
          ];
          defaultSeedDir = ./_private/dms-defaults;
        };
      };

      chiasson.system = {
        ytDlpTelequebecPatch.enable = true;

        audio.enable = true;
        docker.enable = true;
        gaming.enable = true;
        gaming.launchers.enableBottles = false;
        gaming.gamescope.enable = true;
        gaming.steam.steamTinkerLaunch.enable = true;
        gaming.sunshine.enable = true;
        gaming.sunshine.cudaSupport = true;

        streamingDisplay.enable = true;
        # Spare NVIDIA port — verify with: grep -H . /sys/class/drm/card*-*/status
        streamingDisplay.connector = "DP-2";

        monitorInput.enable = true;

        flatpak.enable = true;
        flatpak.flathub.appIds = [ "com.usebottles.bottles" ];

        palera1n.enable = true;
        uconsoleKernelBuilder.enable = true;

        extraPackages = with pkgs; [
          sops
          nodejs_22
          ffmpeg
          bento4
          yt-dlp

          # Native install (avoid flatpak sandbox issues for QSV/VAAPI).
          handbrake

          qbittorrent

          # Diagnostics
          libva-utils # vainfo
          vlc
          element-desktop
          thunderbird

          prismlauncher
          dualsensectl

          devenv
        ];
   

        networking = {
          hostName = "nixdesk";
          networkManager.enable = true;
        };
        librepods.enable = true;
      };

      chiasson.users.enabled = [ "olivier" ];
    };
}
