Files
nixpkgs/pkgs/by-name/kb/kbd/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

150 lines
3.1 KiB
Nix

{
lib,
stdenv,
fetchgit,
nixosTests,
autoreconfHook,
pkg-config,
flex,
perl,
bison,
autoPatchelfHook,
check,
pam,
bash,
bashNonInteractive,
coreutils,
zlib,
bzip2,
xz,
zstd,
gitUpdater,
pkgsCross,
withVlock ? true,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "kbd";
version = "2.9.0";
__structuredAttrs = true;
src = fetchgit {
url = "https://git.kernel.org/pub/scm/linux/kernel/git/legion/kbd.git";
tag = "v${finalAttrs.version}";
hash = "sha256-uUECxFdm/UhoHKLHLFe6/ygCQ+4mrQOZExKl+ReaTNw=";
};
# vlock is moved into its own output, since it depends on pam. This
# reduces closure size for most use cases.
outputs = [
"out"
"dev"
"scripts"
"man"
]
++ lib.optionals withVlock [
"vlock"
];
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
'';
preConfigure = ''
# Perl and Bash only used during build time
patchShebangs --build contrib/
'';
configureFlags = [
"--enable-optional-progs"
"--enable-libkeymap"
"--disable-nls"
(lib.enableFeature withVlock "vlock")
]
++ lib.optionals (!lib.systems.equals stdenv.buildPlatform stdenv.hostPlatform) [
"ac_cv_func_malloc_0_nonnull=yes"
"ac_cv_func_realloc_0_nonnull=yes"
];
strictDeps = true;
enableParallelBuilding = true;
nativeBuildInputs = [
autoreconfHook
pkg-config
flex
perl
bison
autoPatchelfHook # for patching dlopen()
];
nativeCheckInputs = [
check
];
buildInputs = [
zlib
bzip2
xz
zstd
bash
]
++ lib.optionals withVlock [ pam ];
postInstall = ''
substituteInPlace $out/bin/unicode_{start,stop} \
--replace-fail /usr/bin/tty ${coreutils}/bin/tty
moveToOutput bin/unicode_start $scripts
moveToOutput bin/unicode_stop $scripts
''
+ lib.optionalString withVlock ''
moveToOutput bin/vlock $vlock
moveToOutput etc/pam.d/vlock $vlock
'';
outputChecks.out.disallowedRequisites = [
bash
bashNonInteractive
];
passthru = {
updateScript = gitUpdater {
# No nicer place to find latest release.
url = "https://github.com/legionus/kbd.git";
rev-prefix = "v";
};
tests = {
cross =
let
systemString = if stdenv.buildPlatform.isAarch64 then "gnu64" else "aarch64-multiplatform";
in
pkgsCross.${systemString}.kbd;
inherit (nixosTests) keymap kbd-setfont-decompress kbd-update-search-paths-patch;
};
};
meta = {
homepage = "https://kbd-project.org/";
description = "Linux keyboard tools and keyboard maps";
platforms = lib.platforms.linux;
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ davidak ];
};
})