Hi!
I’m completely new to NixOS, coming from Arch.
TLDR is basically the title. Can I avoid a full rebuild of all packages (or dependencies?) after applying an overlay to xkeyboard-config? Why is Nix doing that in the first place?
I use DreymaR’s Colemak-DH mods, but instead of using the included installer/patcher, I forked the upstream xkeyboard-config package and added the patches to the actual source, so that the package wasn’t stuck at the fixed version that DreymaR distributes it. This makes it a lot easier to update and keep up with the new features of xkeyboard-config (I really needed that caps:escape_shifted_capslock
option :P).
I found this thread about installing the same mods, but it was mostly about using the official bash script that overwrites the existing XKB directory, which I’d rather avoid using. I want to use my fork instead.
On Arch, this is trivial to install. Just make an AUR package that provides+conflicts with xkeyboard-config
from the official repositories and then install it.
Here on NixOS, the right way to do it seems to be to use an overlay that overrides the source (and build process) of the package. I based myself off of the example on the NixOS wiki and also added some extra steps so that the package would build correctly. This is the overlay I have now:
self: super:
{
xorg = super.xorg.overrideScope' (
selfx: superx: {
xkeyboardconfig = superx.xkeyboardconfig.overrideAttrs (old: {
src = super.fetchFromGitHub {
owner = "SeerLite";
repo = "xkeyboard-config-bbkt";
rev = "99e90ad6a17bc42a55f3b7965261de8017fbd3ed";
sha256 = "0lbnq9ba81ppp5wrp18yyz8l68h3gpzbkfva3bxdnicj5qzafg2j";
};
preBuild = ''
for file in $(find . -name '*.py'); do
patchShebangs $file
done
'';
nativeBuildInputs = [ self.autoreconfHook self.xorg.utilmacros ] ++ old.nativeBuildInputs;
});
});
}
After adding this to nixpkgs.overlays
in configuration.nix, nixos-rebuild
succesfully builds the package. My issue is that, for some reason, it also rebuilds a bunch of packages that I didn’t touch. Not only that, it doesn’t download the binary version but tries to compile them all locally. And looking at the packages it’s compiling, I’m guessing this would take a long time, which is inconvenient for me. So, why is this happening? Is there a way I can avoid it?
I could also use some feedback on the overlay above or if there’s a better way to do it. I’ve read that there’s a way to add custom XKB layouts to configuration.nix directly and I might end up just doing that if this becomes too complicated, but even then I’d like to get the xkeyboard-config fork working too, at least to learn a bit more about Nix.
Thank you!