nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv, fetchurl, autoreconfHook,
2 gzip, bzip2, pkgconfig, flex, check,
3 pam, coreutils
4}:
5
6stdenv.mkDerivation rec {
7 pname = "kbd";
8 version = "2.0.4";
9
10 src = fetchurl {
11 url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
12 sha256 = "124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz";
13 };
14
15 configureFlags = [
16 "--enable-optional-progs"
17 "--enable-libkeymap"
18 "--disable-nls"
19 ];
20
21 patches = [ ./search-paths.patch ];
22
23 postPatch =
24 ''
25 # Add Neo keymap subdirectory
26 sed -i -e 's,^KEYMAPSUBDIRS *= *,&i386/neo ,' data/Makefile.am
27
28 # Renaming keymaps with name clashes, because loadkeys just picks
29 # the first keymap it sees. The clashing names lead to e.g.
30 # "loadkeys no" defaulting to a norwegian dvorak map instead of
31 # the much more common qwerty one.
32 pushd data/keymaps/i386
33 mv qwertz/cz{,-qwertz}.map
34 mv olpc/es{,-olpc}.map
35 mv olpc/pt{,-olpc}.map
36 mv dvorak/{no.map,dvorak-no.map}
37 mv fgGIod/trf{,-fgGIod}.map
38 mv colemak/{en-latin9,colemak}.map
39 popd
40
41 # Fix the path to gzip/bzip2.
42 substituteInPlace src/libkeymap/findfile.c \
43 --replace gzip ${gzip}/bin/gzip \
44 --replace bzip2 ${bzip2.bin}/bin/bzip2 \
45
46 # We get a warning in armv5tel-linux and the fuloong2f, so we
47 # disable -Werror in it.
48 ${stdenv.lib.optionalString (stdenv.isAarch32 || stdenv.hostPlatform.isMips) ''
49 sed -i s/-Werror// src/Makefile.am
50 ''}
51 '';
52
53 postInstall = ''
54 for i in $out/bin/unicode_{start,stop}; do
55 substituteInPlace "$i" \
56 --replace /usr/bin/tty ${coreutils}/bin/tty
57 done
58 '';
59
60
61 buildInputs = [ check pam ];
62 nativeBuildInputs = [ autoreconfHook pkgconfig flex ];
63
64 makeFlags = [ "setowner=" ];
65
66 meta = with stdenv.lib; {
67 homepage = "ftp://ftp.altlinux.org/pub/people/legion/kbd/";
68 description = "Linux keyboard utilities and keyboard maps";
69 platforms = platforms.linux;
70 license = licenses.gpl2Plus;
71 };
72}