mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-17 13:10:29 +03:00
Merge pull request #242 from samueldr-wip/feature/stage-1-keyboard-input
stage-1: Handle (physical) keyboard input
This commit is contained in:
commit
92b4eb005d
@ -126,6 +126,8 @@ class UI
|
||||
@ta.set_pos(*center(@ta, 0, @unit * 14))
|
||||
# Always present, but initially hidden
|
||||
@ta.hide(skip_animation: true)
|
||||
LVGUI.focus_group.add_obj(@ta)
|
||||
LVGUI.focus_ring_disable()
|
||||
end
|
||||
|
||||
def add_keyboard()
|
||||
|
@ -4,6 +4,21 @@ let
|
||||
key-held = pkgs.runCommand "key-held.mrb" {} ''
|
||||
${pkgs.buildPackages.mruby}/bin/mrbc -o $out ${../boot/applets}/key-held.rb
|
||||
'';
|
||||
minimalX11Config = pkgs.runCommandNoCC "minimalX11Config" {
|
||||
allowedReferences = [ "out" ];
|
||||
} ''
|
||||
(PS4=" $ "; set -x
|
||||
mkdir -p $out
|
||||
cp -r ${pkgs.xlibs.xkeyboardconfig}/share/X11/xkb $out/xkb
|
||||
cp -r ${pkgs.xlibs.libX11.out}/share/X11/locale $out/locale
|
||||
)
|
||||
|
||||
for f in $(grep -lIiR '${pkgs.xlibs.libX11.out}' $out); do
|
||||
printf ':: substituting original path for $out in "%s".\n' "$f"
|
||||
substituteInPlace $f \
|
||||
--replace "${pkgs.xlibs.libX11.out}/share/X11/locale/en_US.UTF-8/Compose" "$out/locale/en_US.UTF-8/Compose"
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
mobile.boot.stage-1.contents = with pkgs; [
|
||||
@ -27,9 +42,19 @@ in
|
||||
object = key-held;
|
||||
symlink = "/applets/key-held.mrb";
|
||||
}
|
||||
{
|
||||
object = "${minimalX11Config}";
|
||||
symlink = "/etc/X11";
|
||||
}
|
||||
];
|
||||
|
||||
mobile.boot.stage-1.extraUtils = with pkgs; [
|
||||
# Used for `key-held.mrb`.
|
||||
{ package = evtest; }
|
||||
];
|
||||
|
||||
mobile.boot.stage-1.environment = {
|
||||
XKB_CONFIG_ROOT = "/etc/X11/xkb";
|
||||
XLOCALEDIR = "/etc/X11/locale";
|
||||
};
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ let
|
||||
filter
|
||||
flatten
|
||||
getBin
|
||||
mapAttrsToList
|
||||
mkOption
|
||||
optionalString
|
||||
optionals
|
||||
@ -97,18 +98,21 @@ let
|
||||
# Converts from list of attrsets, to an attrset indexed by mountPoint.
|
||||
bootFileSystems = listToAttrs (map (item: { name = item.mountPoint; value = item; }) bootFileSystems');
|
||||
|
||||
# These 00-env rules are used both by udev to set the environment, and by
|
||||
# our bespoke init. This makes it a one-stop-shop for preparing the
|
||||
# init environment.
|
||||
envRules = writeText "00-env.rules" (
|
||||
concatStringsSep "\n"
|
||||
(mapAttrsToList (k: v: ''ENV{${k}}="${v}"'') config.mobile.boot.stage-1.environment)
|
||||
);
|
||||
|
||||
udevRules = runCommandNoCC "udev-rules" {
|
||||
allowedReferences = [ extraUtils ];
|
||||
preferLocalBuild = true;
|
||||
} ''
|
||||
mkdir -p $out
|
||||
|
||||
# These 00-env rules are used both by udev to set the environment, and
|
||||
# by our bespoke init.
|
||||
# This makes it a one-stop-shop for preparing the init environment.
|
||||
echo 'ENV{LD_LIBRARY_PATH}="${extraUtils}/lib"' > $out/00-env.rules
|
||||
echo 'ENV{PATH}="${extraUtils}/bin"' >> $out/00-env.rules
|
||||
|
||||
cp -v ${envRules} $out/00-env.rules
|
||||
cp -v ${udev}/lib/udev/rules.d/60-cdrom_id.rules $out/
|
||||
cp -v ${udev}/lib/udev/rules.d/60-input-id.rules $out/
|
||||
cp -v ${udev}/lib/udev/rules.d/60-persistent-input.rules $out/
|
||||
@ -201,7 +205,13 @@ let
|
||||
];
|
||||
} ''
|
||||
mkdir initrd
|
||||
(cd initrd; gzip -cd ${initrd}/initrd | cpio -i)
|
||||
(
|
||||
cd initrd
|
||||
${if config.mobile.boot.stage-1.compression == "gzip" then "gzip -cd ${initrd}/initrd"
|
||||
else if config.mobile.boot.stage-1.compression == "xz" then "xz -cd ${initrd}/initrd"
|
||||
else throw "Cannot decompress ${config.mobile.boot.stage-1.compression} for initrd-meta."
|
||||
} | cpio -i
|
||||
)
|
||||
|
||||
mkdir -p $out
|
||||
ncdu -0x -o $out/initrd.ncdu ./initrd
|
||||
@ -262,6 +272,14 @@ in
|
||||
'';
|
||||
internal = true;
|
||||
};
|
||||
mobile.boot.stage-1.environment = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = ''
|
||||
Environment variables present for the whole stage-1.
|
||||
Keep this as minimal as needed.
|
||||
'';
|
||||
internal = true;
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
@ -291,5 +309,9 @@ in
|
||||
# Transmit all of the mobile NixOS HAL options.
|
||||
HAL = config.mobile.HAL;
|
||||
};
|
||||
mobile.boot.stage-1.environment = {
|
||||
LD_LIBRARY_PATH = "${extraUtils}/lib";
|
||||
PATH = "${extraUtils}/bin";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ mrbgems.mkGem {
|
||||
src = fetchFromGitHub {
|
||||
repo = "mruby-lvgui";
|
||||
owner = "mobile-nixos";
|
||||
rev = "07f6cce17a9819ec9c6da2adea012e3033cfd7b6";
|
||||
sha256 = "0c47vv2slwh2n3996aw219likicpsmlk47ayx8xcl49kpmq674ns";
|
||||
rev = "c82c82e5326540faa2ac47259adbf6254cd1994f";
|
||||
sha256 = "11xpa1fvnv6h0wkjj7h5l4vsyjvbffz4mdcxcdv21nxsdgrsdzdl";
|
||||
};
|
||||
|
||||
gemBuildInputs = [
|
||||
|
@ -21,16 +21,53 @@ let
|
||||
pkgs.buildPackages.python3
|
||||
];
|
||||
});
|
||||
libxkbcommon = pkgs.callPackage (
|
||||
{ stdenv
|
||||
, libxkbcommon
|
||||
, meson
|
||||
, ninja
|
||||
, pkgconfig
|
||||
, yacc
|
||||
}:
|
||||
|
||||
libxkbcommon.overrideAttrs({...}: {
|
||||
nativeBuildInputs = [ meson ninja pkgconfig yacc ];
|
||||
buildInputs = [ ];
|
||||
|
||||
mesonFlags = [
|
||||
"-Denable-wayland=false"
|
||||
"-Denable-x11=false"
|
||||
"-Denable-docs=false"
|
||||
|
||||
# This is because we're forcing uses of this build
|
||||
# to define config and locale root; for stage-1 use.
|
||||
# In stage-2, use the regular xkbcommon lib.
|
||||
"-Dxkb-config-root=/NEEDS/OVERRIDE/etc/X11/xkb"
|
||||
"-Dx-locale-root=/NEEDS/OVERRIDE/share/X11/locale"
|
||||
];
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
# Ensures we don't get any stray dependencies.
|
||||
allowedReferences = [
|
||||
"out"
|
||||
"dev"
|
||||
stdenv.cc.libc_lib
|
||||
];
|
||||
})
|
||||
|
||||
) {};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "lvgui";
|
||||
version = "2020-11-01";
|
||||
version = "2020-11-20";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
repo = "lvgui";
|
||||
owner = "mobile-nixos";
|
||||
rev = "4f8af498a81bd669d42ce3b370fc66fe4ec681b5";
|
||||
sha256 = "00rik18c3c3l4glzh2azg90cwvp56s4wnski86rsn00bxslia5ma";
|
||||
rev = "c94c3916012f5615af027389e77e7a974cc3e634";
|
||||
sha256 = "16dfdky5v72jqs9v22h1k73g74bnif6fg52vhxw2k8sh6mw1cmzp";
|
||||
};
|
||||
|
||||
# Document `LVGL_ENV_SIMULATOR` in the built headers.
|
||||
@ -46,6 +83,7 @@ in
|
||||
|
||||
buildInputs = [
|
||||
libevdev
|
||||
libxkbcommon
|
||||
]
|
||||
++ optionals withSimulator simulatorDeps
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user