{ nixpkgs-unstable, nixpkgs-stable, ... }:

{
  imports =
    [
      ./packages.nix
      ./system.nix
    ];

  # Import local packages
  nixpkgs.overlays = [
    (final: prev: {
      local = import ../../pkgs { pkgs = final; };
    })

    # # Stable
    # (final: prev: {
    #   stable = import nixpkgs-stable {
    #     system = prev.system;
    #   };
    # })

    # Unstable
    (final: prev: {
      unstable = import nixpkgs-unstable {
        system = prev.system;
      };
    })

    # Stable
    (final: prev: {
      stable = import nixpkgs-stable {
        system = prev.system;
      };
    })
  ];

  nixpkgs.config = {
    allowUnfree = true;
    # allowBroken = true;
  };

  nix.extraOptions = ''
    experimental-features = nix-command flakes
  '';

  nix.optimise.automatic = true;

  # Switch to nh
  # nix.gc = {
  #   automatic = true;
  #   dates = "weekly";
  #   options = "--delete-older-than 30d";
  # };
  programs.nh = {
    enable = true;
    clean = {
      enable = true;
      extraArgs = "--keep 5 --keep-since 15d";
    };
    flake = "/home/lyes/Documents/nixos";
  };
}
