# This file defines overlays
# The following overlays must still be included in each system's respective nixpkgs.overlays (i.e. vim hosts/*/default.nix )
#
# nixpkgs.overlays = [
#   outputs.overlays.additions
#   outputs.overlays.modifications
#   outputs.overlays."67e692392-packages"
#   outputs.overlays.kerneol-packages
#   outputs.overlays.master-packages
#   outputs.overlays.my-nixpkgs
#   outputs.overlays.pr540730-packages
#   outputs.overlays.stable-packages
#   outputs.overlays.staging-packages
#   outputs.overlays.wine9_22-packages
# ]

{inputs, ...}: {
  # This one brings our custom packages from the 'pkgs' directory
  additions = final: _prev: import ../pkgs final.pkgs;

  # This one contains whatever you want to overlay
  # You can change versions, add patches, set compilation flags, anything really.
  # https://nixos.wiki/wiki/Overlays
  modifications = final: prev: {
    # example = prev.example.overrideAttrs (oldAttrs: rec {
    # ...
    # });
    #ghostty = prev.ghostty.overrideAttrs (_: {
    #  preBuild = ''
    #    shopt -s globstar
    #    sed -i 's/^const xev = @import("xev");$/const xev = @import("xev").Epoll;/' **/*.zig
    #    shopt -u globstar
    #  '';
    #});

    #linux-firmware = prev.linux-firmware.overrideAttrs (old: rec {
    #  pname = "linux-firmware";
    #  version = "20250708";
    #  src = prev.fetchFromGitLab {
    #    owner = "kernel-firmware";
    #    repo = "linux-firmware";
    #    rev = "99d64b4f788c16e81b6550ef94f43c6b91cfad2d";
    #    hash = "sha256-TJ97A9I0ipsqgg7ex3pAQgdhDJcLbkNCvuLppt9a07o=";
    #  };
    #});

    #proton-ge-bin = prev.proton-ge-bin.overrideAttrs (old: rec {
    #  pname = "proton-ge-bin";
    #  src = prev.fetchzip {
    #    hash = "sha256-NxZ4OJUYQdRNQTb62jRET6Ef14LEhynOASIMPvwWeNA=";
    #    url = "https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${version}/${version}.tar.gz";
    #  };
    #  version = "GE-Proton10-32";
    #});

    reaper = prev.reaper.overrideAttrs (old: rec {
      pname = "reaper";
      src = prev.fetchurl {
        hash = "sha256-yU2WQ35UgEuuU8NJOMgxzQAhg0sGcW4/E0wcxVrWDfE=";
        url = "https://www.reaper.fm/files/${inputs.nixpkgs.lib.versions.major version}.x/reaper${inputs.nixpkgs.lib.versions.major version}${inputs.nixpkgs.lib.versions.minor version}_linux_x86_64.tar.xz";
      };
      version = "7.77";
    });
  };

  #"67e692392-packages" = final: _prev: {
  #  "67e692392" = import inputs.nixpkgs-67e692392 {
  #    inherit (final);
  #    config.allowUnfree = true;
  #    localSystem = final.stdenv.hostPlatform;
  #  };
  #};

  # When applied, the kerneol nixpkgs set (declared in the flake inputs) will
  # be accessible through 'pkgs.kerneol'
  kerneol-packages = final: _prev: {
    kerneol = import inputs.nixpkgs-kerneol {
      inherit (final);
      config.allowUnfree = true;
      localSystem = final.stdenv.hostPlatform;
    };
  };

  # When applied, the master nixpkgs set (declared in the flake inputs) will
  # be accessible through 'pkgs.master'
  master-packages = final: _prev: {
    master = import inputs.nixpkgs-master {
      inherit (final);
      config.allowUnfree = true;
      localSystem = final.stdenv.hostPlatform;
    };
  };

  #my-nixpkgs-packages = final: _prev: {
  #  my-nixpkgs = import inputs.my-nixpkgs {
  #    inherit (final);
  #    config.allowUnfree = true;
  #    localSystem = final.stdenv.hostPlatform;
  #  };
  #};

  pr540730-packages = final: _prev: {
    pr540730 = import inputs.nixpkgs-pr540730 {
      inherit (final);
      config.allowUnfree = true;
      localSystem = final.stdenv.hostPlatform;
    };
  };

  # When applied, the stable nixpkgs set (declared in the flake inputs) will
  # be accessible through 'pkgs.stable'
  stable-packages = final: _prev: {
    stable = import inputs.nixpkgs-stable {
      inherit (final);
      config.allowUnfree = true;
      localSystem = final.stdenv.hostPlatform;
    };
  };

  # When applied, the staging nixpkgs set (declared in the flake inputs) will
  # be accessible through 'pkgs.staging'
  #staging-packages = final: _prev: {
  #  staging = import inputs.nixpkgs-staging {
  #    inherit (final);
  #    config.allowUnfree = true;
  #    localSystem = final.stdenv.hostPlatform;
  #  };
  #};

  #"wine9_22-packages" = final: _prev: {
  #  "wine9_22" = import inputs.nixpkgs-wine9_22 {
  #    inherit (final);
  #    config.allowUnfree = true;
  #    localSystem = final.stdenv.hostPlatform;
  #  };
  #};
}
