From d83b116910b7cc15f1e3bc1ae1fc4a47f06b4beb Mon Sep 17 00:00:00 2001 From: davidak Date: Sun, 11 Apr 2021 02:04:08 +0200 Subject: [PATCH 1/5] kbd: 2.0.4 -> 2.4.0 --- pkgs/os-specific/linux/kbd/default.nix | 32 ++------- pkgs/os-specific/linux/kbd/search-paths.patch | 71 ------------------- 2 files changed, 6 insertions(+), 97 deletions(-) delete mode 100644 pkgs/os-specific/linux/kbd/search-paths.patch diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix index 2119c10b9cf..e709523f452 100644 --- a/pkgs/os-specific/linux/kbd/default.nix +++ b/pkgs/os-specific/linux/kbd/default.nix @@ -1,15 +1,14 @@ { lib, stdenv, fetchurl, autoreconfHook, - gzip, bzip2, pkg-config, flex, check, - pam, coreutils + pkg-config, flex, check, pam, coreutils }: stdenv.mkDerivation rec { pname = "kbd"; - version = "2.0.4"; + version = "2.4.0"; src = fetchurl { url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz"; - sha256 = "124swm93dm4ca0pifgkrand3r9gvj3019d4zkfxsj9djpvv0mnaz"; + sha256 = "17wvrqz2kk0w87idinhyvd31ih1dp7ldfl2yfx7ailygb0279w2m"; }; configureFlags = [ @@ -18,13 +17,8 @@ stdenv.mkDerivation rec { "--disable-nls" ]; - patches = [ ./search-paths.patch ]; - postPatch = '' - # Add Neo keymap subdirectory - sed -i -e 's,^KEYMAPSUBDIRS *= *,&i386/neo ,' data/Makefile.am - # 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 @@ -33,21 +27,9 @@ stdenv.mkDerivation rec { mv qwertz/cz{,-qwertz}.map mv olpc/es{,-olpc}.map mv olpc/pt{,-olpc}.map - mv dvorak/{no.map,dvorak-no.map} mv fgGIod/trf{,-fgGIod}.map mv colemak/{en-latin9,colemak}.map popd - - # Fix the path to gzip/bzip2. - substituteInPlace src/libkeymap/findfile.c \ - --replace gzip ${gzip}/bin/gzip \ - --replace bzip2 ${bzip2.bin}/bin/bzip2 \ - - # We get a warning in armv5tel-linux and the fuloong2f, so we - # disable -Werror in it. - ${lib.optionalString (stdenv.isAarch32 || stdenv.hostPlatform.isMips) '' - sed -i s/-Werror// src/Makefile.am - ''} ''; postInstall = '' @@ -57,16 +39,14 @@ stdenv.mkDerivation rec { done ''; - buildInputs = [ check pam ]; nativeBuildInputs = [ autoreconfHook pkg-config flex ]; - makeFlags = [ "setowner=" ]; - meta = with lib; { - homepage = "ftp://ftp.altlinux.org/pub/people/legion/kbd/"; - description = "Linux keyboard utilities and keyboard maps"; + homepage = "https://kbd-project.org/"; + description = "Linux keyboard tools and keyboard maps"; platforms = platforms.linux; license = licenses.gpl2Plus; + maintainers = with maintainers; [ ]; }; } diff --git a/pkgs/os-specific/linux/kbd/search-paths.patch b/pkgs/os-specific/linux/kbd/search-paths.patch deleted file mode 100644 index c9405a56721..00000000000 --- a/pkgs/os-specific/linux/kbd/search-paths.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- a/src/libkeymap/analyze.l -+++ b/src/libkeymap/analyze.l -@@ -101,6 +101,9 @@ stack_pop(struct lk_ctx *ctx, void *scan - static const char *const include_dirpath0[] = { "", 0 }; - static const char *const include_dirpath1[] = { "", "../include/", "../../include/", 0 }; - static const char *const include_dirpath3[] = { -+ "/etc/kbd/" KEYMAPDIR "/include/", -+ "/etc/kbd/" KEYMAPDIR "/i386/include/", -+ "/etc/kbd/" KEYMAPDIR "/mac/include/", - DATADIR "/" KEYMAPDIR "/include/", - DATADIR "/" KEYMAPDIR "/i386/include/", - DATADIR "/" KEYMAPDIR "/mac/include/", 0 ---- a/src/loadkeys.c -+++ b/src/loadkeys.c -@@ -27,7 +27,7 @@ - #include "keymap.h" - - static const char *progname = NULL; --static const char *const dirpath1[] = { "", DATADIR "/" KEYMAPDIR "/**", KERNDIR "/", 0 }; -+static const char *const dirpath1[] = { "", "/etc/kbd/" KEYMAPDIR "/**", DATADIR "/" KEYMAPDIR "/**", 0 }; - static const char *const suffixes[] = { "", ".kmap", ".map", 0 }; - - static void __attribute__((noreturn)) ---- a/src/loadunimap.c -+++ b/src/loadunimap.c -@@ -30,7 +30,7 @@ - extern char *progname; - extern int force; - --static const char *const unidirpath[] = { "", DATADIR "/" UNIMAPDIR "/", 0 }; -+static const char *const unidirpath[] = { "", "/etc/kbd/" UNIMAPDIR "/", DATADIR "/" UNIMAPDIR "/", 0 }; - static const char *const unisuffixes[] = { "", ".uni", ".sfm", 0 }; - - #ifdef MAIN ---- a/src/mapscrn.c -+++ b/src/mapscrn.c -@@ -27,7 +27,7 @@ void loadnewmap(int fd, char *mfil); - static int ctoi(char *); - - /* search for the map file in these directories (with trailing /) */ --static const char *const mapdirpath[] = { "", DATADIR "/" TRANSDIR "/", 0 }; -+static const char *const mapdirpath[] = { "", "/etc/kbd/" TRANSDIR "/", DATADIR "/" TRANSDIR "/", 0 }; - static const char *const mapsuffixes[] = { "", ".trans", "_to_uni.trans", ".acm", 0 }; - - #ifdef MAIN ---- a/src/resizecons.c -+++ b/src/resizecons.c -@@ -101,7 +101,7 @@ static int vga_get_fontheight(void); - static void vga_set_cursor(int, int); - static void vga_set_verticaldisplayend_lowbyte(int); - --const char *const dirpath[] = { "", DATADIR "/" VIDEOMODEDIR "/", 0 }; -+const char *const dirpath[] = { "", "/etc/kbd/" VIDEOMODEDIR "/", DATADIR "/" VIDEOMODEDIR "/", 0}; - const char *const suffixes[] = { "", 0 }; - - int main(int argc, char **argv) ---- a/src/setfont.c -+++ b/src/setfont.c -@@ -53,10 +53,10 @@ int force = 0; - int debug = 0; - - /* search for the font in these directories (with trailing /) */ --const char *const fontdirpath[] = { "", DATADIR "/" FONTDIR "/", 0 }; -+const char *const fontdirpath[] = { "", "/etc/kbd/" FONTDIR "/", DATADIR "/" FONTDIR "/", 0 }; - const char *const fontsuffixes[] = { "", ".psfu", ".psf", ".cp", ".fnt", 0 }; - /* hide partial fonts a bit - loading a single one is a bad idea */ --const char *const partfontdirpath[] = { "", DATADIR "/" FONTDIR "/" PARTIALDIR "/", 0 }; -+const char *const partfontdirpath[] = { "", "/etc/kbd/" FONTDIR "/" PARTIALDIR "/", DATADIR "/" FONTDIR "/" PARTIALDIR "/", 0 }; - const char *const partfontsuffixes[] = { "", 0 }; - - static inline int From fabdd4650344ba93d657a643466c027f40ef3c87 Mon Sep 17 00:00:00 2001 From: davidak Date: Sun, 11 Apr 2021 02:09:07 +0200 Subject: [PATCH 2/5] kbdKeymaps: remove dvp and neo are now included in kbd includes documentation in release notes and alias --- nixos/doc/manual/release-notes/rl-2105.xml | 11 +++++++ nixos/modules/config/console.nix | 3 +- pkgs/os-specific/linux/kbd/keymaps.nix | 36 ---------------------- pkgs/top-level/aliases.nix | 1 + pkgs/top-level/all-packages.nix | 2 -- 5 files changed, 13 insertions(+), 40 deletions(-) delete mode 100644 pkgs/os-specific/linux/kbd/keymaps.nix diff --git a/nixos/doc/manual/release-notes/rl-2105.xml b/nixos/doc/manual/release-notes/rl-2105.xml index e0552c25a85..1efc60060b8 100644 --- a/nixos/doc/manual/release-notes/rl-2105.xml +++ b/nixos/doc/manual/release-notes/rl-2105.xml @@ -680,6 +680,17 @@ environment.systemPackages = [ All CUDA toolkit versions prior to CUDA 10 have been removed. + + + The kbdKeymaps package was removed since dvp and neo + are now included in kbd. + + If you want to use the Programmer Dvorak Keyboard Layout, you have to use + dvorak-programmer in + now instead of dvp. + In it's still dvp. + + diff --git a/nixos/modules/config/console.nix b/nixos/modules/config/console.nix index 84ad76246fd..5be7f06c05d 100644 --- a/nixos/modules/config/console.nix +++ b/nixos/modules/config/console.nix @@ -82,8 +82,7 @@ in packages = mkOption { type = types.listOf types.package; - default = with pkgs.kbdKeymaps; [ dvp neo ]; - defaultText = "with pkgs.kbdKeymaps; [ dvp neo ]"; + default = [ ]; description = '' List of additional packages that provide console fonts, keymaps and other resources for virtual consoles use. diff --git a/pkgs/os-specific/linux/kbd/keymaps.nix b/pkgs/os-specific/linux/kbd/keymaps.nix deleted file mode 100644 index b3d5fe1b63c..00000000000 --- a/pkgs/os-specific/linux/kbd/keymaps.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ stdenv, lib, fetchurl, gzip }: - -{ - dvp = stdenv.mkDerivation rec { - pname = "dvp"; - version = "1.2.1"; - - src = fetchurl { - url = "http://kaufmann.no/downloads/linux/dvp-${lib.replaceStrings ["."] ["_"] version}.map.gz"; - sha256 = "0e859211cfe16a18a3b9cbf2ca3e280a23a79b4e40b60d8d01d0fde7336b6d50"; - }; - - nativeBuildInputs = [ gzip ]; - - buildCommand = '' - mkdir -p $out/share/keymaps/i386/dvorak - gzip -c -d $src > $out/share/keymaps/i386/dvorak/dvp.map - ''; - }; - - neo = stdenv.mkDerivation { - pname = "neo"; - version = "2476"; - - src = fetchurl { - name = "neo.map"; - url = "https://raw.githubusercontent.com/neo-layout/neo-layout/" - + "a0dee06fed824abfad658b7f10e6d907b270be0a/linux/console/neo.map"; - sha256 = "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"; - }; - - buildCommand = '' - install -D $src $out/share/keymaps/i386/neo/neo.map - ''; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 5097794b16c..309d2ab58e2 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -338,6 +338,7 @@ mapAliases ({ kodiPlainWayland = kodi-wayland; julia_07 = throw "julia_07 is deprecated in favor of julia_10 LTS"; # added 2020-09-15 julia_11 = throw "julia_11 is deprecated in favor of latest Julia version"; # added 2020-09-15 + kbdKeymaps = throw "kbdKeymaps is not needed anymore since dvp and neo are now part of kbd"; # added 2021-04-11 kdeconnect = plasma5Packages.kdeconnect-kde; # added 2020-10-28 kdiff3-qt5 = kdiff3; # added 2017-02-18 keepass-keefox = keepass-keepassrpc; # backwards compatibility alias, added 2018-02 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 440bdb97fd7..7ef9f066a99 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -19766,8 +19766,6 @@ in kbd = callPackage ../os-specific/linux/kbd { }; - kbdKeymaps = callPackage ../os-specific/linux/kbd/keymaps.nix { }; - kbdlight = callPackage ../os-specific/linux/kbdlight { }; kmscon = callPackage ../os-specific/linux/kmscon { }; From 513143fe4ef0734483640945250b39d1732f7298 Mon Sep 17 00:00:00 2001 From: davidak Date: Sun, 11 Apr 2021 05:25:53 +0200 Subject: [PATCH 3/5] kbd: add tests and update them --- nixos/tests/keymap.nix | 27 +++++++++++++++++++++++--- pkgs/os-specific/linux/kbd/default.nix | 4 +++- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/nixos/tests/keymap.nix b/nixos/tests/keymap.nix index 09d5d2a6c9e..a18a05f90c6 100644 --- a/nixos/tests/keymap.nix +++ b/nixos/tests/keymap.nix @@ -107,17 +107,32 @@ in pkgs.lib.mapAttrs mkKeyboardTest { altgr.expect = [ "~" "#" "{" "[" "|" ]; }; - extraConfig.console.keyMap = "azerty/fr"; + extraConfig.console.keyMap = "fr"; extraConfig.services.xserver.layout = "fr"; }; + bone = { + tests = { + layer1.qwerty = [ "f" "j" ]; + layer1.expect = [ "e" "n" ]; + layer2.qwerty = [ "shift-f" "shift-j" "shift-6" ]; + layer2.expect = [ "E" "N" "$" ]; + layer3.qwerty = [ "caps_lock-d" "caps_lock-f" ]; + layer3.expect = [ "{" "}" ]; + }; + + extraConfig.console.keyMap = "bone"; + extraConfig.services.xserver.layout = "de"; + extraConfig.services.xserver.xkbVariant = "bone"; + }; + colemak = { tests = { homerow.qwerty = [ "a" "s" "d" "f" "j" "k" "l" "semicolon" ]; homerow.expect = [ "a" "r" "s" "t" "n" "e" "i" "o" ]; }; - extraConfig.console.keyMap = "colemak/colemak"; + extraConfig.console.keyMap = "colemak"; extraConfig.services.xserver.layout = "us"; extraConfig.services.xserver.xkbVariant = "colemak"; }; @@ -129,9 +144,13 @@ in pkgs.lib.mapAttrs mkKeyboardTest { symbols.qwerty = [ "q" "w" "e" "minus" "equal" ]; symbols.expect = [ "'" "," "." "[" "]" ]; }; + + extraConfig.console.keyMap = "dvorak"; + extraConfig.services.xserver.layout = "us"; + extraConfig.services.xserver.xkbVariant = "dvorak"; }; - dvp = { + dvorak-programmer = { tests = { homerow.qwerty = [ "a" "s" "d" "f" "j" "k" "l" "semicolon" ]; homerow.expect = [ "a" "o" "e" "u" "h" "t" "n" "s" ]; @@ -142,6 +161,7 @@ in pkgs.lib.mapAttrs mkKeyboardTest { symbols.expect = [ "&" "[" "{" "}" "(" "=" "*" ")" "+" "]" "!" ]; }; + extraConfig.console.keyMap = "dvorak-programmer"; extraConfig.services.xserver.layout = "us"; extraConfig.services.xserver.xkbVariant = "dvp"; }; @@ -156,6 +176,7 @@ in pkgs.lib.mapAttrs mkKeyboardTest { layer3.expect = [ "{" "}" ]; }; + extraConfig.console.keyMap = "neo"; extraConfig.services.xserver.layout = "de"; extraConfig.services.xserver.xkbVariant = "neo"; }; diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix index e709523f452..396546eec9f 100644 --- a/pkgs/os-specific/linux/kbd/default.nix +++ b/pkgs/os-specific/linux/kbd/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, autoreconfHook, +{ lib, stdenv, fetchurl, nixosTests, autoreconfHook, pkg-config, flex, check, pam, coreutils }: @@ -42,6 +42,8 @@ stdenv.mkDerivation rec { buildInputs = [ check pam ]; nativeBuildInputs = [ autoreconfHook pkg-config flex ]; + passthru.tests = nixosTests.keymap; + meta = with lib; { homepage = "https://kbd-project.org/"; description = "Linux keyboard tools and keyboard maps"; From f250c8f6df3a9edb6550ecb69b0ebcf1ddb83562 Mon Sep 17 00:00:00 2001 From: davidak Date: Tue, 13 Apr 2021 07:29:11 +0200 Subject: [PATCH 4/5] kbd: format using nixpkgs-fmt --- pkgs/os-specific/linux/kbd/default.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix index 396546eec9f..20e46b743ec 100644 --- a/pkgs/os-specific/linux/kbd/default.nix +++ b/pkgs/os-specific/linux/kbd/default.nix @@ -1,5 +1,13 @@ -{ lib, stdenv, fetchurl, nixosTests, autoreconfHook, - pkg-config, flex, check, pam, coreutils +{ lib +, stdenv +, fetchurl +, nixosTests +, autoreconfHook +, pkg-config +, flex +, check +, pam +, coreutils }: stdenv.mkDerivation rec { @@ -49,6 +57,6 @@ stdenv.mkDerivation rec { description = "Linux keyboard tools and keyboard maps"; platforms = platforms.linux; license = licenses.gpl2Plus; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ ]; }; } From 77c103298c813166e9b6d631e66173ee86e838c1 Mon Sep 17 00:00:00 2001 From: davidak Date: Tue, 13 Apr 2021 07:30:11 +0200 Subject: [PATCH 5/5] kbd: add myself as maintainer --- pkgs/os-specific/linux/kbd/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kbd/default.nix b/pkgs/os-specific/linux/kbd/default.nix index 20e46b743ec..467de4b029a 100644 --- a/pkgs/os-specific/linux/kbd/default.nix +++ b/pkgs/os-specific/linux/kbd/default.nix @@ -57,6 +57,6 @@ stdenv.mkDerivation rec { description = "Linux keyboard tools and keyboard maps"; platforms = platforms.linux; license = licenses.gpl2Plus; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ davidak ]; }; }