Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 23.11 25 lines 696 B view raw
1{ lib }: 2 3let 4 # This is essentially the same thing as `lib.makeOverridable`, except storing 5 # the override method in a method named `overridePackage` so that it's not 6 # shadowed by the `override` method added by `callPackage` 7 makePackageOverridable = f: args: 8 let 9 result = lib.makeOverridable f args; 10 11 copyArgs = g: lib.setFunctionArgs g (lib.functionArgs f); 12 13 overrideWith = 14 update: args // (if lib.isFunction update then update args else update); 15 16 overridePackage = 17 copyArgs (update: makePackageOverridable f (overrideWith update)); 18 19 in 20 result // { inherit overridePackage; }; 21 22in 23 lib // { 24 inherit makePackageOverridable; 25 }