Help Overriding Python Library in Nixos + Home Manager

I’m trying to work on my nixos configuration, and am trying to implement an overlay to replace the python sqlalchemy library (currently v2.0.21) with an older version, already packaged as sqlalchemy_1_4. The ‘upgrade’ to 2.0 is known to break many things, so the older version is still available. An application I’m trying to install required the sqlalchemy-migrate library, which is not compatible with sqlalchemy 2.0+. Therefore, I’d like to use an overlay to override this build input.

However, the application is installed through home manager, called as below in my flake.nix:

outputs = inputs@{nixpkgs, home-manager, nixpkgs-stable,...}: let 
    pkgs = (inputs: {
      nixpkgs = {
        config = {
          allowUnfree = true;
          allowBroken = true;
        };
        overlays = import ./pkgs/overlays.nix {inherit nixpkgs-stable; pkgs = nixpkgs;};
      };
    });
    in
    {
    nixosConfigurations = {
      UnknownDevice_ux535 = inputs.nixpkgs.lib.nixosSystem {
        system = "x86_64-linux";
        modules = [
          pkgs
          ./nixos/systems/specific/ux535/config.nix
          home-manager.nixosModules.home-manager
          {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.users.daniel = import ./home/daniel/home/home.nix;
          }
        ];
      };
...

I’m testing the below overlay just installing python, trying to get the sqlalchemy library to revert to the previous version, but pip freeze still shows the new version. I’ve tried several variations (not at the same time) to no success.

(self: super: {

    self.pythonPackageExtensions = super.pythonPackageExtensions.override {
      packageOverrides = pyself: pysuper: {
        pyself.sqlalchemy = pysuper.sqlalchemy_1_4;  
      };
    };
}

self: super: {

    self.python311Packages = super.python311Packages.overrideAttrs (oldAttrs: {
      overrides = pyself: pysuper: {
        sqlalchemy = super.sqlalchemy_1_4;  
      };
    }); 
}

The application I’m trying to install is openlp, for context. I believe that, most likely, the direct sqlalchemy input to the application needs overriding, but also the sqlalchemy input of sqlalchemy-migrate, itself an input. I would have thought it wouldn’t be too much worse than:

self.openlp = super.openlp.override{
      sqlalchemy = super.sqlalchemy_1_4;
      sqlalchemy-migrate = super.sqlalchemy-migrate.override{
        sqlalchemy=super.sqlalchemy_1_4;
      };
    };

but this doesn’t build, giving the same error as before. Where am I going wrong here?

Hi,

I’m the maintainer of OpenLP in Nixpkgs. I’m sorry I didn’t reply, but now, a (functioning) update to OpenLP-3.1.2 is under review. You can already use the package, just get the expression from my branch.

If you like to get this merged ASAP, it would be a great help if you contribute to the review, e.g. by testing the functionality of the executable, or by reviewing the code.

.Also, I am looking for co-maintainers, since I don’t use OpenLP any more, currently.