{ hardware
, ristrettoSigningKeyPath
, stripeSecretKeyPath
, issuerDomains
, letsEncryptAdminEmail
, allowedChargeOrigins
, sshUsers
, stateVersion
, publicIPv4
, ...
}: rec {
  deployment = {
    targetUser = "root";
    targetHost = publicIPv4;

    secrets = {
      "ristretto-signing-key" = {
        source = ristrettoSigningKeyPath;
        destination = "/run/keys/ristretto.signing-key";
        owner.user = "root";
        owner.group = "root";
        permissions = "0400";
        action = ["sudo" "systemctl" "restart" "zkapissuer.service"];
      };
      "stripe-secret-key" = {
        source = stripeSecretKeyPath;
        destination = "/run/keys/stripe.secret-key";
        owner.user = "root";
        owner.group = "root";
        permissions = "0400";
        action = ["sudo" "systemctl" "restart" "zkapissuer.service"];
      };
    };
  };

  imports = [
    hardware
    ../../nixos/modules/issuer.nix
  ];

  services.private-storage.sshUsers = sshUsers;
  services.private-storage-issuer = {
    enable = true;
    tls = true;
    ristrettoSigningKeyPath = deployment.secrets.ristretto-signing-key.destination;
    stripeSecretKeyPath = deployment.secrets.stripe-secret-key.destination;
    database = "SQLite3";
    databasePath = "/var/db/vouchers.sqlite3";
    inherit letsEncryptAdminEmail;
    domains = issuerDomains;
    inherit allowedChargeOrigins;
  };

  system.stateVersion = stateVersion;
}