{
  config,
  lib,
  pkgs,
  ...
}:

{
  imports = [
    ./openpgp-card-ssh-agent.nix
  ];

  options.me = {
    openpgp_card_tools.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = "Whether we want to install openpgp-card-tools.";
    };
  };

  config = lib.mkIf config.me.openpgp_card_tools.enable {
    environment.systemPackages = with pkgs; [
      openpgp-card-tools
      openpgp-card-tool-git
      openpgp-card-ssh-agent
    ];

    nixpkgs.overlays = [
      (final: prev: {
        openpgp-card-tool-git = (final.callPackage ./package/openpgp-card-tool-git/package.nix { });
        openpgp-card-ssh-agent = (final.callPackage ./package/openpgp-card-ssh-agent/package.nix { });
      })
    ];

    me.install.user.talexander.file = {
      ".config/openpgp-card-state/config.toml" = {
        source = ./files/openpgp-card-state.toml;
      };
    };

    # The current openpgp-card-ssh-agent has an outdated dependency on openpgp-card-state which makes it not handle my current openpgp-card-state.toml
    # services.openpgp-card-ssh-agent.enable = true;
  };
}
