anchor.diff:  { lib, pkgs, config, ... }:
   with lib;
  -let cfg = config.systemFoundry.jellyfin;
  +let
  +  cfg = config.systemFoundry.jellyfin;
  +  stateDir = "/var/lib/jellyfin"; # todo: hardcoded
   in
   {
     options.systemFoundry.jellyfin = {
  
positive.code:       default = "jellyfin";
        description = "User to server jellyfin under";
      };
    };
  
    config = mkIf cfg.enable {
  
negative.code:       enable = true;
        proxyPass = "http://127.0.0.1:8096";
      };
  
      # jellyfin provides no native backup, so zip, compress it, and copy it over
      systemd.services.jellyfin-backup = mkIf cfg.backup.enable {
        startAt = "*-*-* 3:00:00";
        path = with pkgs;[
          coreutils
          gnutar
          pigz
        ];
        script = ''
          mkdir -p ${cfg.backup.destinationPath}
          tar --use-compress-program="pigz -k --best" -cvf ${cfg.backup.destinationPath}/jellyfin-$(date +%Y-%m-%d).tar.gz ${stateDir}
  
        '';
      };
    };
  }
  