{lib, pkgs, ...}:
let
  overlay = (final: prev: {
    clifm = prev.clifm.overrideAttrs (old: {
      version = "1.23";
      src = prev.fetchFromGitHub {
        owner = "leo-arch";
        repo = prev.clifm.pname;
        rev = "v1.23";
        hash = "sha256-FtlLz77yy/QfRyAhJSh5juCSPCZ921sTGhuYJzCusus=";
      };
    });
  });
  file_picker = pkgs.writeScriptBin "file_picker" (builtins.readFile "${pkgs.clifm}/share/clifm/plugins/file_picker.sh");
in
{
  home.packages = with pkgs.extend overlay; [ atool fzf xdragon unzip zip sshfs clifm ]
    ++ [ file_picker ];
  xdg.configFile."clifm/profiles/default/clifmrc".source = ./clifm/clifmrc;
  xdg.configFile."clifm/profiles/default/mimelist.clifm".source = ./clifm/mimelist.clifm;
  home.sessionVariables = {
    CLIFM_TERM = "alacritty"; # TODO UNHARDCODE THIS
    CLIFM_TEMPLATES_DIR = "$HOME/Modèles";
  };
}
