Unverified Commit 5654dea8 authored by Michele Guerini Rocco's avatar Michele Guerini Rocco Committed by GitHub
Browse files

Merge pull request #264787 from katexochen/feat/xkb-extralayouts

nixos/x11: move extraLayouts into xkb attrset
parents 1b56805d 7d7744f1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ qt.style = "gtk2";

It is possible to install custom [ XKB
](https://en.wikipedia.org/wiki/X_keyboard_extension) keyboard layouts
using the option `services.xserver.extraLayouts`.
using the option `services.xserver.xkb.extraLayouts`.

As a first example, we are going to create a layout based on the basic
US layout, with an additional layer to type some greek symbols by
@@ -235,7 +235,7 @@ xkb_symbols "us-greek"
A minimal layout specification must include the following:

```nix
services.xserver.extraLayouts.us-greek = {
services.xserver.xkb.extraLayouts.us-greek = {
  description = "US layout with alt-gr greek";
  languages   = [ "eng" ];
  symbolsFile = /yourpath/symbols/us-greek;
@@ -298,7 +298,7 @@ xkb_symbols "media"
As before, to install the layout do

```nix
services.xserver.extraLayouts.media = {
services.xserver.xkb.extraLayouts.media = {
  description  = "Multimedia keys remapping";
  languages    = [ "eng" ];
  symbolsFile  = /path/to/media-key;
+1 −1
Original line number Diff line number Diff line
@@ -322,7 +322,7 @@
  order, or relying on `mkBefore` and `mkAfter`, but may impact users calling
  `mkOrder n` with n ≤ 400.

- X keyboard extension (XKB) options have been reorganized into a single attribute set, `services.xserver.xkb`. Specifically, `services.xserver.layout` is now `services.xserver.xkb.layout`, `services.xserver.xkbModel` is now `services.xserver.xkb.model`, `services.xserver.xkbOptions` is now `services.xserver.xkb.options`, `services.xserver.xkbVariant` is now `services.xserver.xkb.variant`, and `services.xserver.xkbDir` is now `services.xserver.xkb.dir`.
- X keyboard extension (XKB) options have been reorganized into a single attribute set, `services.xserver.xkb`. Specifically, `services.xserver.layout` is now `services.xserver.xkb.layout`, `services.xserver.extraLayouts` is now `services.xserver.xkb.extraLayouts`, `services.xserver.xkbModel` is now `services.xserver.xkb.model`, `services.xserver.xkbOptions` is now `services.xserver.xkb.options`, `services.xserver.xkbVariant` is now `services.xserver.xkb.variant`, and `services.xserver.xkbDir` is now `services.xserver.xkb.dir`.

- `networking.networkmanager.firewallBackend` was removed as NixOS is now using iptables-nftables-compat even when using iptables, therefore Networkmanager now uses the nftables backend unconditionally.

+25 −17
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
with lib;

let
  layouts = config.services.xserver.extraLayouts;
  layouts = config.services.xserver.xkb.extraLayouts;

  layoutOpts = {
    options = {
@@ -80,16 +80,24 @@ let
  };

  xkb_patched = pkgs.xorg.xkeyboardconfig_custom {
    layouts = config.services.xserver.extraLayouts;
    layouts = config.services.xserver.xkb.extraLayouts;
  };

in

{

  imports = [
    (lib.mkRenamedOptionModuleWith {
      sinceRelease = 2311;
      from = [ "services" "xserver" "extraLayouts" ];
      to = [ "services" "xserver" "xkb" "extraLayouts" ];
    })
  ];

  ###### interface

  options.services.xserver = {
  options.services.xserver.xkb = {
    extraLayouts = mkOption {
      type = types.attrsOf (types.submodule layoutOpts);
      default = { };
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ in pkgs.lib.mapAttrs mkKeyboardTest {

    extraConfig.console.useXkbConfig = true;
    extraConfig.services.xserver.xkb.layout = "us-greek";
    extraConfig.services.xserver.extraLayouts.us-greek =
    extraConfig.services.xserver.xkb.extraLayouts.us-greek =
      { description = "US layout with alt-gr greek";
        languages   = [ "eng" ];
        symbolsFile = pkgs.writeText "us-greek" ''
+1 −1
Original line number Diff line number Diff line
@@ -568,7 +568,7 @@ This is how the pull request looks like in this case: [https://github.com/NixOS/
To run the main types of tests locally:

- Run package-internal tests with `nix-build --attr pkgs.PACKAGE.passthru.tests`
- Run [NixOS tests](https://nixos.org/manual/nixos/unstable/#sec-nixos-tests) with `nix-build --attr nixosTest.NAME`, where `NAME` is the name of the test listed in `nixos/tests/all-tests.nix`
- Run [NixOS tests](https://nixos.org/manual/nixos/unstable/#sec-nixos-tests) with `nix-build --attr nixosTests.NAME`, where `NAME` is the name of the test listed in `nixos/tests/all-tests.nix`
- Run [global package tests](https://nixos.org/manual/nixpkgs/unstable/#sec-package-tests) with `nix-build --attr tests.PACKAGE`, where `PACKAGE` is the name of the test listed in `pkgs/test/default.nix`
- See `lib/tests/NAME.nix` for instructions on running specific library tests