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
|
2023-10-09 19:29:22 +00:00
|
|
|
, gitUpdater
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "kbd";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "2.6.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
|
2023-11-16 04:20:00 +00:00
|
|
|
sha256 = "sha256-BJlsCNfRxGCWb7JEo9OIM1LCZ0t61SIAPZ9Oy4q0jes=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# vlock is moved into its own output, since it depends on pam. This
|
|
|
|
# reduces closure size for most use cases.
|
|
|
|
outputs = [ "out" "vlock" "dev" ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
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 '
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
sed -i '
|
|
|
|
1i prefix:=$(vlock)
|
|
|
|
1i bindir := $(vlock)/bin' \
|
|
|
|
src/vlock/Makefile.in \
|
|
|
|
src/vlock/Makefile.am
|
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
|
|
|
};
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru = {
|
|
|
|
gzip = gzip;
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
# No nicer place to find latest release.
|
|
|
|
url = "https://github.com/legionus/kbd.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
};
|
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
|
|
|
};
|
|
|
|
}
|