Build fails for patched xkeyboard_config -- missing automake-1.15

I’m trying to get better support for the Chromebook special function keys by applying this patch to xkeyboard_config. I’m a little confused as to where that package is defined, since I can only find xkeyboardconfig.

I’m using system.replaceRuntimeDependencies (though I also tried environment.systemPackages with the same results) and passing in

    {
      original = pkgs.xkeyboard_config;
      replacement = pkgs.xkeyboard_config.overrideAttrs (super: {
        patches = [ xkeyboardconfigPatch ];
        nativeBuildInputs = super.nativeBuildInputs ++ [ pkgs.automake ];
      });
    }

where

  xkeyboardconfigPatch = pkgs.fetchurl {
    url = "https://raw.githubusercontent.com/GalliumOS/xkeyboard-config/master/debian/patches/chromebook.patch";
    sha256 = "19b59wmzmiivgqhk6dwb1zwsqs5h9wcpvws85s0in3hb0njv303c";
  };

When I rebuild, I get this output

building
build flags: -j4 -l4 SHELL=/nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash
Making all in compat
make[1]: Entering directory '/build/xkeyboard-config-2.24/compat'
 cd .. && /nix/store/cinw572b38aln37glr0zb8lxwrgaffl4-bash-4.4-p23/bin/bash /build/xkeyboard-config-2.24/missing automake-1.15 --foreign compat/Makefile
/build/xkeyboard-config-2.24/missing: line 81: automake-1.15: command not found
WARNING: 'automake-1.15' is missing on your system.
         You should only need it if you modified 'Makefile.am' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'automake' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make[1]: *** [Makefile:315: Makefile.in] Error 127
make[1]: Leaving directory '/build/xkeyboard-config-2.24/compat'
make: *** [Makefile:461: all-recursive] Error 1
builder for '/nix/store/wsgspz1ymrqc7iv802ghh8h5xl4pbq6a-xkeyboard-config-2.24.drv' failed with exit code 2

It looks like the fact the patch touches Makefile.am makes it require automake, but I’m not sure why it’s trying to run version 1.15. The only versions in nixpkgs are 1.11 and 1.16.

How can I get this to build with the version of automake I have? Is the unpatched case only building because it’s not trying to run automake?

Yes, it’s a custom that release tarballs already contain the output of the autotools generators, so you do not need them when building, unless you change some particular files (e.g. **.am or configure.ac). Still, I’m not a user of autotools myself (as it seems like hell to me), so I don’t know too much.

I would try adding autoreconfHook to nativeBuildInputs, this should fix the missing error at least.