I’ve been trying to get a few Anki add-ons built and one of the add-ons I’m trying to pull in is fsrs4anki-helper. This add-on, among others, isn’t offered by nixpkgs ( and checking NixOS search today, it seems like anki, anki-connect, passfail2, review-heatmap, yomichan-forvo-server, local-audio-yomichan have gone AWOL ) so I’ve been using the home-manager example for non-nixpkg add-ons as a template to build the remaining.
The issue I’m encountering is that fsrs4anki-helper includes a submodule, python-i8n, as part of the repository. I didn’t account for this initially and ended up with an empty python_i8n directory and the add-on failing to initialize as a consequence of this. I did a bit of digging around, found fetchSubmodules, enabled it and tried rebuilding but ended up with an empty directory again.
I’m not sure if this is a local caching issue, if I’m not understanding how fetchSubmodules or fetchFromGitHub is supposed to work or what’s happening, but I haven’t managed to get python_i8n pulled in as a submodule of fsrs4anki-helper. I’m fairly new to Nix so apologies in advance if I’m doing something obviously wrong or otherwise missed something obvious. I’m still wrapping my head around the declarative system/derivatives and haven’t developed a good system for tracking down docs or debugging issues yet.
The issue is that fetchFromGitHub produces a fixed-output derivation (FOD), so if you just add fetchSubmodules = true; without re-generating the hash, the old one will be used (which doesn’t include the submodule).
So, if you set hash = "";, rebuild, and use the new hash that’s printed, it should work.
Beautiful. Thank you for taking the time to look at this! Re-generating the hash was the key. Looks like I just didn’t understand how fetchFromGitHub was working. Following your advice, I was able to get fsrs4anki-helper to build and have verified that it’s initializing and functioning as expected. I also appreciate you taking the time to open a PR to have it included in nixpkgs.
I’m building about nine other add-ons outside of this one, six of which I’ve verified are building and working as expected. I’ll study your PR, read through the packaging tutorial/nixpkgs reference and see about opening some PR’s for the add-ons I’ve gotten working.
Thanks again! Not knowing what I was doing wrong was driving me nuts.