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

let cfg = config.sydnix.zotero;
in {
  options.sydnix.zotero = {
    enable = lib.mkEnableOption "Zotero";
  };

  config = lib.mkIf cfg.enable {
    home.packages = [
      pkgs.zotero
    ];

    sydnix.impermanence.directories =
      let xdg-data-home =
        lib.removePrefix "${config.home.homeDirectory}"
          (lib.removePrefix "~"
            config.xdg.dataHome);
      in [
        ".zotero"
        "${xdg-data-home}/zotero"
      ];
  };
}
