Use old nixpkgs's package with current pkgs set

Because I’m running on some errors when using straight a package from the older NixOs channel 22.11 (qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat), I would like to re-use the derivation that people wrote in 22.11 while feeding it with the current nixpkgs dependencies. What is the cleanest way to do that? Notably, the derivation might involve Qt stuff, like musescore’s derivation.

IME, this tends to break as often as it succeeds. But if the package you want is relatively simple, you can use callPackage (or libsForQt5.callPackage or whatever is appropriate) from your current Nixpkgs and point it to the path of the package in the old Nixpkgs. Something like:

(pkgs.libsForQt5.callPackage <nixos-22.11/pkgs/applications/audio/musescore> { })

That’s a nice idea, thanks, I was rather trying instead to directly use mypackage.override pkgs but this fails as pkgs contains often more elements than expected by the function. We can’t adapt this other, path-independent, approach?

I guess you could try something like this:

pkgsOld.musescore.override (
    (lib.functionArgs pkgsOld.musescore.override)
    (pkgs // pkgs.libsForQt5)

But, uh, seems pretty fragile even relative to the path-based approach. I’d be worried about some dependency on the old Nixpkgs leaking through the override call, particularly if using some exotic scope.

Thanks, I wasn’t aware of the existance of these functions… but I think it will run into an issue if, for instance, an argument like enableFoo ? false is present, as functionArgs will set the value of enableFoo to true since it only saves whether the argument has a default value or not. I guess I’ll stick to the path-based approach, but out of curiosity is it possible to default value of arguments of a function, and check if its type is a derivation or not?