Say I have to patch the libinput
package to enable the palm rejection functionality on macbook, it works fine using an overlay but caused a lot of thing to recompile. I want to just replace the libinput
in the dependency closure of xf86_input_mtrack
and don’t affect other packages, what should I do?
You should be able to use the following override:
self: super: {
xf86_input_mtrack = super.xf86_input_mtrack.override {
libinput = super.libinput.overrideAttrs (attrs: {
patches = attrs.patches ++ [
…
];
});
};
}
That is, first override the patches
attribute of the libinput package
using overrideAttrs
method, and then override the libinput
argument
passed to the mtrack package by callPackage
using override
method.
It’d be slightly better to use the libinput
from the old arguments, rather than replacing it with super.libinput
.
self: super: {
xf86_input_mtrack = super.xf86_input_mtrack.override (mtrackOld: {
libinput = mtrackOld.libinput.overrideAttrs (attrs: {
patches = attrs.patches ++ [
…
];
});
});
}
This way, if xf86_input_mtrack
was already receiving an overridden libinput
, that will be preserved.
Will this snippet work?
self: super: {
xf86_input_mtrack = (import pkgs.path { overlays = [
(self: super: {
libinput = super.libinput.overrideAttrs (attrs: {
patches = attrs.patches ++ [
(fetchurl {
url = "https://gist.githubusercontent.com/peterychuang/5cf9bf5
27bc26adef47d714c758a5509/raw/eace1794287bb2e9903f7a7f3c6e2496346b321e/0001-udev-
Add-Apple-SPI-Keyboard-and-Touchpad.patch";
sha256 = "0as4ahv1jdiv6nrdcw9rcn82hnajihfm6zxrj1idlqk40zy1jijr";
})
];
}
);
})
]; }).xf86_input_mtrack;
}
Well I forgot to mention that I say indirect dependency
because I think libinput
is a dependency of an input to xf86_input_mtrack
, not the direct input to xf86_input_mtrack
. ( I’m wrong about it, using nix why-depends
shows there isn’t such dependency, so I don’t have a good example now to experiment, just want to discuss with you.)
It will probably work but also take twice as long to evaluate due to nixpkgs being evaluated twice. It might be better to find what is depending on libinput or just go with the top-level libinput override and cause more rebuild.