at 23.05-pre 81 lines 2.0 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, nixosTests 5, autoreconfHook 6, pkg-config 7, flex 8, check 9, pam 10, coreutils 11, gzip 12, bzip2 13, xz 14, zstd 15}: 16 17stdenv.mkDerivation rec { 18 pname = "kbd"; 19 version = "2.5.1"; 20 21 src = fetchurl { 22 url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz"; 23 sha256 = "sha256-zN9FI4emOAlz0pJzY+nLuTn6IGiRWm+Tf/nSRSICRoM="; 24 }; 25 26 configureFlags = [ 27 "--enable-optional-progs" 28 "--enable-libkeymap" 29 "--disable-nls" 30 ]; 31 32 patches = [ 33 ./search-paths.patch 34 ]; 35 36 postPatch = 37 '' 38 # Renaming keymaps with name clashes, because loadkeys just picks 39 # the first keymap it sees. The clashing names lead to e.g. 40 # "loadkeys no" defaulting to a norwegian dvorak map instead of 41 # the much more common qwerty one. 42 pushd data/keymaps/i386 43 mv qwertz/cz{,-qwertz}.map 44 mv olpc/es{,-olpc}.map 45 mv olpc/pt{,-olpc}.map 46 mv fgGIod/trf{,-fgGIod}.map 47 mv colemak/{en-latin9,colemak}.map 48 popd 49 50 # Fix paths to decompressors. Trailing space to avoid replacing `xz` in `".xz"`. 51 substituteInPlace src/libkbdfile/kbdfile.c \ 52 --replace 'gzip ' '${gzip}/bin/gzip ' \ 53 --replace 'bzip2 ' '${bzip2.bin}/bin/bzip2 ' \ 54 --replace 'xz ' '${xz.bin}/bin/xz ' \ 55 --replace 'zstd ' '${zstd.bin}/bin/zstd ' 56 ''; 57 58 postInstall = '' 59 for i in $out/bin/unicode_{start,stop}; do 60 substituteInPlace "$i" \ 61 --replace /usr/bin/tty ${coreutils}/bin/tty 62 done 63 ''; 64 65 buildInputs = [ check pam ]; 66 NIX_LDFLAGS = lib.optional stdenv.hostPlatform.isStatic "-laudit"; 67 nativeBuildInputs = [ autoreconfHook pkg-config flex ]; 68 69 passthru.tests = { 70 inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch; 71 }; 72 passthru.gzip = gzip; 73 74 meta = with lib; { 75 homepage = "https://kbd-project.org/"; 76 description = "Linux keyboard tools and keyboard maps"; 77 platforms = platforms.linux; 78 license = licenses.gpl2Plus; 79 maintainers = with maintainers; [ davidak ]; 80 }; 81}