2021-05-20 23:08:51 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, flex
|
|
|
|
, check
|
|
|
|
, pam
|
|
|
|
, coreutils
|
2021-06-28 23:13:55 +00:00
|
|
|
, gzip
|
|
|
|
, bzip2
|
|
|
|
, xz
|
|
|
|
, zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "kbd";
|
2021-05-20 23:08:51 +00:00
|
|
|
version = "2.4.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
|
2021-05-20 23:08:51 +00:00
|
|
|
sha256 = "17wvrqz2kk0w87idinhyvd31ih1dp7ldfl2yfx7ailygb0279w2m";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-optional-progs"
|
|
|
|
"--enable-libkeymap"
|
|
|
|
"--disable-nls"
|
|
|
|
];
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
patches = [
|
|
|
|
./search-paths.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch =
|
|
|
|
''
|
|
|
|
# Renaming keymaps with name clashes, because loadkeys just picks
|
|
|
|
# the first keymap it sees. The clashing names lead to e.g.
|
|
|
|
# "loadkeys no" defaulting to a norwegian dvorak map instead of
|
|
|
|
# the much more common qwerty one.
|
|
|
|
pushd data/keymaps/i386
|
|
|
|
mv qwertz/cz{,-qwertz}.map
|
|
|
|
mv olpc/es{,-olpc}.map
|
|
|
|
mv olpc/pt{,-olpc}.map
|
|
|
|
mv fgGIod/trf{,-fgGIod}.map
|
|
|
|
mv colemak/{en-latin9,colemak}.map
|
|
|
|
popd
|
2021-06-28 23:13:55 +00:00
|
|
|
|
|
|
|
# Fix paths to decompressors. Trailing space to avoid replacing `xz` in `".xz"`.
|
|
|
|
substituteInPlace src/libkbdfile/kbdfile.c \
|
|
|
|
--replace 'gzip ' '${gzip}/bin/gzip ' \
|
|
|
|
--replace 'bzip2 ' '${bzip2.bin}/bin/bzip2 ' \
|
|
|
|
--replace 'xz ' '${xz.bin}/bin/xz ' \
|
|
|
|
--replace 'zstd ' '${zstd.bin}/bin/zstd '
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for i in $out/bin/unicode_{start,stop}; do
|
|
|
|
substituteInPlace "$i" \
|
|
|
|
--replace /usr/bin/tty ${coreutils}/bin/tty
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ check pam ];
|
2022-05-18 14:49:53 +00:00
|
|
|
NIX_LDFLAGS = lib.optional stdenv.hostPlatform.isStatic "-laudit";
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config flex ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
passthru.tests = {
|
2021-08-05 21:33:18 +00:00
|
|
|
inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
|
2021-06-28 23:13:55 +00:00
|
|
|
};
|
2022-04-15 01:41:22 +00:00
|
|
|
passthru.gzip = gzip;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-05-20 23:08:51 +00:00
|
|
|
homepage = "https://kbd-project.org/";
|
|
|
|
description = "Linux keyboard tools and keyboard maps";
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
license = licenses.gpl2Plus;
|
2021-05-20 23:08:51 +00:00
|
|
|
maintainers = with maintainers; [ davidak ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|