Skip to content
Commit 731e0fa7 authored by Benno Fünfstück's avatar Benno Fünfstück Committed by Peter Simons
Browse files

haskell: preserve overrideScope on override

We want code such as `(pkg.override {}).overrideScope (self: super: {})` to
work. This didn't work before, since `override` will call the original package
again, and the attribute `overideScope`, which `callPackageWithScope` added,
wasn't added again. The fix for this is to modify the package function itself
to include the `callPackageWithScope` attribute, so it'll be re-added whenever
the function is overriden for with arguments.

There is a small problem here though: since callPackage uses some magic
(`builtins.functionArgs`) to determine the auto-arguments of a function, we
can't just write `callPackageWith scope drvScope`, since
`builtins.functionArgs drvScope` will be `{}`. To fix this, we implement our own
`callPackageWith`.

Fixes https://github.com/NixOS/nixpkgs/issues/7953.
Closes https://github.com/NixOS/nixpkgs/pull/9336.
parent 9b74549c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment