{
  pkgs,
  inputs,
  lib,
  config,
  ...
}: let
  cfg = config.dots.flatpak;
in {
  imports = [
    inputs.nix-flatpak.homeManagerModules.nix-flatpak
    ./devtoolbox
  ];

  options.dots.flatpak = {
    enable = lib.mkEnableOption "enables all programs by default";
  };

  # brought to you by nix-flatpak, readme is below
  # https://github.com/gmodena/nix-flatpak?tab=readme-ov-file

  config = lib.mkIf cfg.enable {

    home.sessionVariables = {
      XDG_DATA_DIRS = "$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share";
    };

    # install the cli
    home.packages = with pkgs; [ flatpak ];

    services.flatpak = {
      #remotes = {};
    };

    dots = {
      devtoolbox.enable = lib.mkDefault true;
    };
  };
}
