Skip to content

nixos/anki-sync-server: init#257692

Merged
wegank merged 3 commits intoNixOS:masterfrom
telotortium:anki-sync-server
Dec 1, 2023
Merged

nixos/anki-sync-server: init#257692
wegank merged 3 commits intoNixOS:masterfrom
telotortium:anki-sync-server

Conversation

@telotortium
Copy link
Copy Markdown
Contributor

@telotortium telotortium commented Sep 27, 2023

Description of changes

Provide a NixOS module for the built-in Anki Sync Server included in recent versions of Anki. This supersedes the ankisyncd module, but we should keep that for now because ankisyncd supports older versions of Anki clients than this module.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions Bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Sep 27, 2023
@github-actions github-actions Bot added 8.has: documentation This PR adds or changes documentation 8.has: changelog This PR adds or changes release notes labels Sep 27, 2023
@telotortium
Copy link
Copy Markdown
Contributor Author

@martinetd as maintainer of ankisyncd.

Copy link
Copy Markdown

@de11n de11n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know anything about Anki so I just have random stylistic comments.

Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
@telotortium
Copy link
Copy Markdown
Contributor Author

@de11n in the manual test, why isn't my introduced option services.anki-sync-server.enable producing a correct reference #opt-services.anki-sync-server.enable?

Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
@ofborg ofborg Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Sep 27, 2023
Copy link
Copy Markdown
Member

@martinetd martinetd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work! Everything about packaging anki has been a pain to me, so anyone working on this is greatly appreciated.
I've got a few high level questions first, didn't look at the module itself yet; I'll take a bit of time for that this weekend.

Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
Comment thread nixos/modules/services/misc/anki-sync-server.md Outdated
Copy link
Copy Markdown

@de11n de11n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better! Thanks! I'll let others take it from here who actually know what Anki does. 😄

Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
Copy link
Copy Markdown
Member

@martinetd martinetd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've played with this a bit, rebased and added a few commits in https://github.com/martinetd/nixpkgs/commits/anki-sync-server-nixos

I didn't have anywhere to cmment individually, but this is missing adding the module to nixos/modules/module-list.nix ( martinetd@ccfbafe ); which makes this hard to use :) Took me a while to understand why test didn't find services.anki-sync-server !

I've added a nixosTests and switched to the pending anki-sync-server binary; not quite sure what to do order-wise here wrt this PR, but it's identical to anki --syncserver so this is probably fine to do later.
(We might want to change services.anki-sync-server.package in favor of something like server_command that'd be either "${pkgs.anki}/bin/anki --syncserver" or "${pkgs.anki-sync-server}/bin/anki-sync-server" ...)

The added test needs the 23.10beta6 update because anki's internal changed a tiny little bit (at least col.sync_collection(login, False) needs to be changed to col.sync_collection(login) for 2.1.66); I think rest would work)
The tests need updating for 23.10 so I've split the test commit and its update as we probably don't want to wait for anki update (the anki-sync-server package looks like it'll get in fast enough to use)

Last would be to really decide how we want the modules to evolve.
Keeping both services.ankisyncd and services.anki-sync-server might seem good at first but data migration will be a pain later because we'll have users with data in either directory: I'd be in favor of replacing services.ankisyncd with this, keeping just the data path working as said last week.

WDYT?

Comment thread nixos/modules/services/misc/anki-sync-server.nix Outdated
Comment thread nixos/modules/services/misc/anki-sync-server.md Outdated
@h7x4 h7x4 added 8.has: module (new) This PR adds a module in `nixos/` and removed 8.has: module (update) This PR changes an existing module in `nixos/` labels Oct 16, 2023
@github-actions github-actions Bot added the 8.has: module (update) This PR changes an existing module in `nixos/` label Nov 22, 2023
telotortium pushed a commit to telotortium/nixpkgs that referenced this pull request Nov 22, 2023
anki-sync-server will be used in new ankisyncd module.

anki itself was slightly modified to add its cargoLock as passthru so we
can use it for anki-sync-server as it's built from the same sources.

Link: NixOS#257692
Co-authored-by: Pavel Sobolev <paveloom@riseup.net>
Co-authored-by: h7x4 <h7x4@nani.wtf>
@telotortium
Copy link
Copy Markdown
Contributor Author

telotortium commented Nov 22, 2023

@martinetd sorry for not getting back earlier - I didn't realize you had committed so many changes on your branch. I've pushed your commits to this PR.

I am going to have to rebase to master to fix some merge conflicts in the docs.

Copy link
Copy Markdown
Member

@martinetd martinetd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Last review before you update the package -- as far as I'm concerned, the new module is good to go, just these small details + anki update left)

Comment thread nixos/doc/manual/release-notes/rl-2311.section.md Outdated
Comment thread pkgs/servers/ankisyncd/default.nix Outdated
@telotortium
Copy link
Copy Markdown
Contributor Author

@martinetd Can we drop the initial commit with 2.1.66 and directly start at 23.10 (ideally 23.10.1)? I presume so

@martinetd
Copy link
Copy Markdown
Member

@martinetd Can we drop the initial commit with 2.1.66 and directly start at 23.10 (ideally 23.10.1)? I presume so

Sure feel free to rewrite history, but the commit should be separate as it updates anki too, not just anki-sync-server.
So I guess you can reoder the commits and squash the test fix, but that's about it?
I have no hard preference, feel free to do as you like :)

@telotortium
Copy link
Copy Markdown
Contributor Author

@martinetd Can we drop the initial commit with 2.1.66 and directly start at 23.10 (ideally 23.10.1)? I presume so

Sure feel free to rewrite history, but the commit should be separate as it updates anki too, not just anki-sync-server. So I guess you can reoder the commits and squash the test fix, but that's about it? I have no hard preference, feel free to do as you like :)

I started with 2.1.66 and make a separate commit to update to 23.10.1.

@telotortium
Copy link
Copy Markdown
Contributor Author

@de11n @martinetd can one of you merge?

@ofborg ofborg Bot requested a review from martinetd November 28, 2023 06:37
@paveloom
Copy link
Copy Markdown
Member

I would suggest making this dependent on #264796 and marking as a draft until that PR is merged.

Copy link
Copy Markdown
Member

@martinetd martinetd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest making this dependent on #264796 and marking as a draft until that PR is merged.

It's been open for a while but I guess it's likely the other PR will get in first...
We don't actually really care about which version gets in except for the test that breaks; we could just remove the version update and test addition for now and add it in a later PR @telotortium ?
That way this PR won't need to wait on anything.

And I do not have merge rights, sorry. Once the release note comment is fixed up we can bring it up in https://discourse.nixos.org/t/prs-already-reviewed/2617 and someone should take a look.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(continuing other outdated thread here)
happy to make the modification in the ankisyncd module later but this is just wrong as clients supported are the same, let's just write will be deprecated or something.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be done in a PR deprecating the module, I think.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I see you removed the mention about older clients -- this is fine with me

@telotortium telotortium marked this pull request as draft November 29, 2023 20:44
wegank pushed a commit to martinetd/nixpkgs that referenced this pull request Nov 30, 2023
anki-sync-server will be used in new ankisyncd module.

anki itself was slightly modified to add its cargoLock as passthru so we
can use it for anki-sync-server as it's built from the same sources.

Link: NixOS#257692
Co-authored-by: Pavel Sobolev <paveloom@riseup.net>
Co-authored-by: h7x4 <h7x4@nani.wtf>
@martinetd
Copy link
Copy Markdown
Member

@wegank merged both the anki update and the anki-sync-server package addition just now (Thanks!!)

I'll rebase this and fix the release notes wording tonight if you don't have time before me; shouldn't be much longer :)

@wegank wegank force-pushed the anki-sync-server branch 2 times, most recently from de55e00 to 17100af Compare November 30, 2023 04:21
@wegank
Copy link
Copy Markdown
Member

wegank commented Nov 30, 2023

@ofborg build anki.passthru.tests

@ofborg ofborg Bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. and removed 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. labels Nov 30, 2023
telotortium and others added 2 commits November 30, 2023 17:25
Provide a NixOS module for the [built-in Anki Sync
Server](https://docs.ankiweb.net/sync-server.html) included in recent
versions of Anki. This supersedes the `ankisyncd` module, but we should
keep that for now because `ankisyncd` supports older versions of Anki
clients than this module.
Start anki-sync-server service and drive anki manually through its
python lib to test sync.
The anki python part isn't a stable API and might require freqent
rework, let's see if it holds up...
@wegank wegank marked this pull request as ready for review November 30, 2023 16:26
@telotortium
Copy link
Copy Markdown
Contributor Author

@wegank can we merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: module (new) This PR adds a module in `nixos/` 8.has: module (update) This PR changes an existing module in `nixos/` 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants