3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/kbd/default.nix

80 lines
1.9 KiB
Nix
Raw Normal View History

2021-04-13 06:29:11 +01:00
{ lib
, stdenv
, fetchurl
, nixosTests
, autoreconfHook
, pkg-config
, flex
, check
, pam
, coreutils
2021-05-30 15:59:40 +01:00
, gzip
, bzip2
, xz
, zstd
}:
stdenv.mkDerivation rec {
pname = "kbd";
2021-04-11 01:04:08 +01:00
version = "2.4.0";
src = fetchurl {
url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
2021-04-11 01:04:08 +01:00
sha256 = "17wvrqz2kk0w87idinhyvd31ih1dp7ldfl2yfx7ailygb0279w2m";
};
2015-04-02 02:36:31 +01:00
configureFlags = [
"--enable-optional-progs"
"--enable-libkeymap"
"--disable-nls"
];
2021-07-19 21:10:17 +01:00
patches = [
./search-paths.patch
];
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-05-30 15:59:40 +01: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 '
'';
postInstall = ''
2017-07-29 23:33:26 +01:00
for i in $out/bin/unicode_{start,stop}; do
substituteInPlace "$i" \
--replace /usr/bin/tty ${coreutils}/bin/tty
done
'';
buildInputs = [ check pam ];
nativeBuildInputs = [ autoreconfHook pkg-config flex ];
passthru.tests = {
2021-07-19 21:10:17 +01:00
inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
};
2021-04-11 04:25:53 +01:00
meta = with lib; {
2021-04-11 01:04:08 +01:00
homepage = "https://kbd-project.org/";
description = "Linux keyboard tools and keyboard maps";
platforms = platforms.linux;
license = licenses.gpl2Plus;
2021-04-13 06:30:11 +01:00
maintainers = with maintainers; [ davidak ];
};
}