2021-04-13 05:29:11 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
, autoreconfHook
|
|
|
|
, pkg-config
|
|
|
|
, flex
|
|
|
|
, check
|
|
|
|
, pam
|
|
|
|
, coreutils
|
2021-05-30 14:59:40 +00:00
|
|
|
, gzip
|
|
|
|
, bzip2
|
|
|
|
, xz
|
|
|
|
, zstd
|
2023-08-19 11:17:44 +00:00
|
|
|
, gitUpdater
|
2017-07-29 22:21:44 +00:00
|
|
|
}:
|
2007-04-04 09:18:39 +00:00
|
|
|
|
2009-06-05 17:16:14 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "kbd";
|
2023-12-12 06:38:05 +00:00
|
|
|
version = "2.6.4";
|
2007-04-04 09:18:39 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
|
2023-12-12 06:38:05 +00:00
|
|
|
sha256 = "sha256-UZ+NCHrsyn4KM80IS++SwGbrGXMWZmU9zHDJ1xqkCSY=";
|
2007-04-04 09:18:39 +00:00
|
|
|
};
|
|
|
|
|
2023-05-25 13:45:34 +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-04-15 09:53:18 +00:00
|
|
|
|
2015-04-02 01:36:31 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-optional-progs"
|
|
|
|
"--enable-libkeymap"
|
|
|
|
"--disable-nls"
|
|
|
|
];
|
2015-03-09 01:14:19 +00:00
|
|
|
|
2021-07-19 20:10:17 +00:00
|
|
|
patches = [
|
|
|
|
./search-paths.patch
|
|
|
|
];
|
|
|
|
|
2015-04-07 18:26:36 +00:00
|
|
|
postPatch =
|
2012-07-24 17:10:53 +00:00
|
|
|
''
|
2018-10-08 23:21:28 +00:00
|
|
|
# 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 14:59:40 +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-05-25 13:45:34 +00:00
|
|
|
|
|
|
|
sed -i '
|
|
|
|
1i prefix:=$(vlock)
|
|
|
|
1i bindir := $(vlock)/bin' \
|
|
|
|
src/vlock/Makefile.in \
|
|
|
|
src/vlock/Makefile.am
|
2012-07-24 17:10:53 +00:00
|
|
|
'';
|
2010-01-29 21:30:09 +00:00
|
|
|
|
2017-07-29 22:21:44 +00:00
|
|
|
postInstall = ''
|
2017-07-29 22:33:26 +00:00
|
|
|
for i in $out/bin/unicode_{start,stop}; do
|
|
|
|
substituteInPlace "$i" \
|
|
|
|
--replace /usr/bin/tty ${coreutils}/bin/tty
|
|
|
|
done
|
2017-07-29 22:21:44 +00:00
|
|
|
'';
|
|
|
|
|
2016-07-01 00:51:01 +00:00
|
|
|
buildInputs = [ check pam ];
|
2022-04-24 12:00:00 +00:00
|
|
|
NIX_LDFLAGS = lib.optional stdenv.hostPlatform.isStatic "-laudit";
|
2021-01-19 06:50:56 +00:00
|
|
|
nativeBuildInputs = [ autoreconfHook pkg-config flex ];
|
2015-03-09 01:14:19 +00:00
|
|
|
|
2021-05-30 18:37:14 +00:00
|
|
|
passthru.tests = {
|
2021-07-19 20:10:17 +00:00
|
|
|
inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
|
2021-05-30 18:37:14 +00:00
|
|
|
};
|
2023-08-19 11:17:44 +00:00
|
|
|
passthru = {
|
|
|
|
gzip = gzip;
|
|
|
|
updateScript = gitUpdater {
|
|
|
|
# No nicer place to find latest release.
|
|
|
|
url = "https://github.com/legionus/kbd.git";
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
|
|
|
};
|
2021-04-11 03:25:53 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-04-11 00:04:08 +00:00
|
|
|
homepage = "https://kbd-project.org/";
|
|
|
|
description = "Linux keyboard tools and keyboard maps";
|
2016-07-01 00:51:01 +00:00
|
|
|
platforms = platforms.linux;
|
2017-04-29 04:24:34 +00:00
|
|
|
license = licenses.gpl2Plus;
|
2021-04-13 05:30:11 +00:00
|
|
|
maintainers = with maintainers; [ davidak ];
|
2010-01-18 10:19:11 +00:00
|
|
|
};
|
2007-04-04 09:18:39 +00:00
|
|
|
}
|