Accessing packages from multiple channels using flakes

Hi, I’m trying to using flakes with my system configuration, but I’m struggling with importing packages from different branches of nixpkgs. At the moment, I have this :

{ inputs, ... }:
  environment.systemPackages = [ inputs.unstable.neofetch ];

but it seems that I cannot access unstable this way, or at least I cannot use this that way. Is there some kind of workaround to get over this ? I tried looking at Bqv’s configuration repository, but I cannot fully understand it at the moment, although it seems that he creates an overlay on pkgs attribute to use Does anyone has an idea ? Thanks for taking the time to read / answer.

using something like

  overlay-unstable = final: prev: {
    unstable = *name-of-the-unstable-input*.legacyPackages.${system};
in nixpkgs.overlays = [ overlay-unstable.unstable ];

worked for the system configuration, however it does not seem to work for my HM configuration, based on Ryantm template, I tried something like

    flake-utils.lib.eachDefaultSystem (system:
        pkgs = stable.legacyPackages.${system};
        overlay-unstable = final: prev: {
          unstable = nixpkgs-unstable.legacyPackages.${system};
      in {
        devShell = pkgs.mkShell rec {
          name = "home-manager-shell";

          buildInputs = with pkgs;
            [ (import home-manager { inherit pkgs; }).home-manager ];

          shellHook = ''
            export NIX_PATH="nixpkgs=${stable}:home-manager=${home-manager}"
            export HOME_MANAGER_CONFIG="./home.nix"
            PS1="${name}> "
        nixpkgs.overlays = [ overlay-unstable.unstable ];

but the overlay isn’t enabled, or at least I cannot use pkgs.unstable.package.