I’d like to bump the Anki version from 2.15.1 to whatever is the latest. I created this overlay:
final: prev:
# This doesn't work. Even though it looks like I'm doing exactly the same as
# https://github.com/flyingcircusio/fc-nixos/blob/a1c1063c4f2205fb6385fadc53083425451af5db/pkgs/overlay-python.nix
# https://discourse.nixos.org/t/overriding-not-being-kept/7818/2
# https://nixos.org/nixpkgs/manual/#how-to-override-a-python-package-using-overlays
# https://nixos.org/nixpkgs/manual/#python Talks about overridePythonAttrs
let
sources = import ../../nix/sources.nix;
pkgs = import sources.nixpkgs { };
ankiOverlay = python-final: python-prev: {
anki = python-prev.anki.overridePythonAttrs (oldAttrs: rec {
version = "2.1.26";
pname = oldAttrs.pname;
src = python-prev.fetchurl {
urls = [
"https://apps.ankiweb.net/downloads/current/${pname}-${version}-source.tgz"
# "https://apps.ankiweb.net/downloads/current/${name}-source.tgz"
# "http://ankisrs.net/download/mirror/${name}.tgz"
# "http://ankisrs.net/download/mirror/archive/${name}.tgz"
];
sha256 = "0000000000000000000000000000000000000000000000000000";
};
# sha256-pkg = "0000000000000000000000000000000000000000000000000000";
# rev-manual = "8f6387867ac37ef3fe9d0b986e70f898d1a49139";
# sha256-manual = "0pm5slxn78r44ggvbksz7rv9hmlnsvn9z811r6f63dsc8vm6mfml";
});
};
in
{
python = prev.python.override {
packageOverrides = ankiOverlay;
};
python3 = prev.python3.override {
packageOverrides = ankiOverlay;
};
python37 = prev.python37.override {
packageOverrides = ankiOverlay;
};
python38 = prev.python38.override {
packageOverrides = ankiOverlay;
};
}
It took me a bit to figure out that overriding python packages is very different from overriding other packages. But my overlay is still not active. Anki is at 2.1.15. Even if I remove the content of prev.fetchurl { } it doesn’t complain about anything. I have this in my home.nix
I’ve gotten a bit closer but it’s still not working.
The error became quite obvious when I added another overlay which didn’t work, even though it was super simple. The difference between the working overlays and the non-working ones was that the working ones were for things installed through home manager options, like programs.neovim.enable = true. The others came from a nixpkgs set which I imported from sources.nix from niv. Applying overlays in my home.nix through nixpkgs.overlays only applies to the pkgset which is “controlled by Home Manager”. If I add the overlays to
Hm that’s true but I’d like to at least have the current version working on my machine before creating a PR. Unfortunately I already tried various things from different sources. To be precise, I checked the info from
Ok sorry for answering my own questions… anki is a normal CLI application and it’s therefore packaged in a simpler way. It is the library packages which are added to the package set of the different library versions. TIL reading the manual thoroughly helps.
It would be cool if the Anki package could be update from .15 to a newer release. Some of the addons available require a newer version of Anki (It’s up to 0.34 now). Not sure if what was posted works, but 0.28 would be a good start.
It looked like updating it to a newer version required more work than just a version bump but I’ll look into it tomorrow, promise. Still have two days off.
I tried updating the package but I have 0 python knowledge and stuff breaks left and right. I guess I was able to adapt the build to the changed folder layout but the tests are all failing and I don’t know how pytest works and I just don’t have time to look into that right now
I guess or hope that this is just busy work for someone who knows python and the only thing that needs to be updated are some paths here and there.
EDIT: Actually I’ll reach out to someone knowledgeable about Anki
the problem with anki is that they changed a lot of their project structure, and the current derivation makes a lot of assumptions about what is located where.
Not to mention that alot anki’s build process bootstraps itself through touching network
Yup. One of my colleagues is a frequent contributor to Anki though so he should be able to help. My hope is that the Nix way of doing things (use builders to fetch these things in advance) works as well and if not maybe some upstream changes can be made to make that more feasible. I’ll definitely keep working on this.
@cideM can you ask them to add build instructions. Also, allow for an easier way to build the package while in a sandbox. The current derivation is running a lot of sed commands to remove network behavior.
As the maintainer of anki-bin, no. It’s a terrible, terrible hacky package that we should drop as soon as we get source builds going again.
I’m fairly positive that, contrary to their other build systems, they’ll stay with Bazel for longer than a year, so there shouldn’t be any huge packaging delays like this going forward.