nixos/ankisyncd: use ankisyncd-rs instead of the old python one

Unfortunately the config is not compatible; data itself looks like it was compatible
from an up to date python ankisyncd but I wouldn't assume anything with the older
service (which didn't work for me with either ankidroid or recent desktop version)
This commit is contained in:
Dominique Martinet 2023-07-04 18:12:41 +09:00
parent 5c7df30c0a
commit 668f528b6c
2 changed files with 12 additions and 16 deletions

View File

@ -84,6 +84,10 @@
- `services.fail2ban.jails` can now be configured with attribute sets defining settings and filters instead of lines. The stringed options `daemonConfig` and `extraSettings` have respectively been replaced by `daemonSettings` and `jails.DEFAULT.settings` which use attribute sets.
- The module [services.ankisyncd](#opt-services.ankisyncd.package) has been switched to [anki-sync-server-rs](https://github.com/ankicommunity/anki-sync-server-rs) from the old python version, which was difficult to update, had not been updated in a while, and did not support recent versions of anki.
Unfortunately all servers supporting new clients (newer version of anki-sync-server, anki's built in sync server and this new rust package) do not support the older sync protocol that was used in the old server, so such old clients will also need updating and in particular the anki package in nixpkgs is also being updated in this release.
The module update takes care of the new config syntax and the data itself (user login and cards) are compatible, so users of the module will be able to just log in again after updating both client and server without any extra action.
- `services.nginx` gained a `defaultListen` option at server-level with support for PROXY protocol listeners, also `proxyProtocol` is now exposed in `services.nginx.virtualHosts.<name>.listen` option. It is now possible to run PROXY listeners and non-PROXY listeners at a server-level, see [#213510](https://github.com/NixOS/nixpkgs/pull/213510/) for more details.
- `services.prometheus.exporters` has a new exporter to monitor electrical power consumption based on PowercapRAPL sensor called [Scaphandre](https://github.com/hubblo-org/scaphandre), see [#239803](https://github.com/NixOS/nixpkgs/pull/239803) for more details.

View File

@ -9,22 +9,16 @@ let
stateDir = "/var/lib/${name}";
authDbPath = "${stateDir}/auth.db";
toml = pkgs.formats.toml {};
sessionDbPath = "${stateDir}/session.db";
configFile = pkgs.writeText "ankisyncd.conf" (lib.generators.toINI {} {
sync_app = {
configFile = toml.generate "ankisyncd.conf" {
listen = {
host = cfg.host;
port = cfg.port;
data_root = stateDir;
auth_db_path = authDbPath;
session_db_path = sessionDbPath;
base_url = "/sync/";
base_media_url = "/msync/";
};
});
paths.root_dir = stateDir;
# encryption.ssl_enable / cert_file / key_file
};
in
{
options.services.ankisyncd = {
@ -32,7 +26,7 @@ in
package = mkOption {
type = types.package;
default = pkgs.ankisyncd;
default = pkgs.ankisyncd-rs;
defaultText = literalExpression "pkgs.ankisyncd";
description = lib.mdDoc "The package to use for the ankisyncd command.";
};
@ -59,8 +53,6 @@ in
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
environment.etc."ankisyncd/ankisyncd.conf".source = configFile;
systemd.services.ankisyncd = {
description = "ankisyncd - Anki sync server";
after = [ "network.target" ];
@ -71,7 +63,7 @@ in
Type = "simple";
DynamicUser = true;
StateDirectory = name;
ExecStart = "${cfg.package}/bin/ankisyncd";
ExecStart = "${cfg.package}/bin/ankisyncd --config ${configFile}";
Restart = "always";
};
};