Skip to content

Commit

Permalink
lomiri.*: Updates (#341377)
Browse files Browse the repository at this point in the history
  • Loading branch information
OPNA2608 authored Oct 12, 2024
2 parents bf39b43 + 127dfa6 commit e58a261
Show file tree
Hide file tree
Showing 16 changed files with 263 additions and 499 deletions.
8 changes: 2 additions & 6 deletions nixos/modules/services/desktop-managers/lomiri.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ in {
libayatana-common
ubports-click
]) ++ (with pkgs.lomiri; [
content-hub
hfd-service
history-service
libusermetrics
lomiri
lomiri-calculator-app
lomiri-camera-app
lomiri-clock-app
lomiri-content-hub
lomiri-docviewer-app
lomiri-download-manager
lomiri-filemanager-app
Expand Down Expand Up @@ -129,7 +129,7 @@ in {

environment.pathsToLink = [
# Configs for inter-app data exchange system
"/share/content-hub/peers"
"/share/lomiri-content-hub/peers"
# Configs for inter-app URL requests
"/share/lomiri-url-dispatcher/urls"
# Splash screens & other images for desktop apps launched via lomiri-app-launch
Expand Down Expand Up @@ -194,10 +194,6 @@ in {
};

users.groups.usermetrics = { };

# TODO content-hub cannot pass files between applications without asking AA for permissions. And alot of the Lomiri stack is designed with AA availability in mind. This might be a requirement to be closer to upstream?
# But content-hub currently fails to pass files between applications even with AA enabled, and we can get away without AA in many places. Let's see how this develops before requiring this for good.
# security.apparmor.enable = true;
};

meta.maintainers = lib.teams.lomiri.members;
Expand Down
193 changes: 98 additions & 95 deletions nixos/tests/lomiri.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@ let
user = "alice";
description = "Alice Foobar";
password = "foobar";

# tmpfiles setup to make OCRing on terminal output more reliable
terminalOcrTmpfilesSetup =
{
pkgs,
lib,
config,
}:
let
white = "255, 255, 255";
black = "0, 0, 0";
colorSection = color: {
Color = color;
Bold = true;
Transparency = false;
};
terminalColors = pkgs.writeText "customized.colorscheme" (
lib.generators.toINI { } {
Background = colorSection white;
Foreground = colorSection black;
Color2 = colorSection black;
Color2Intense = colorSection black;
}
);
terminalConfig = pkgs.writeText "terminal.ubports.conf" (
lib.generators.toINI { } {
General = {
colorScheme = "customized";
fontSize = "16";
fontStyle = "Inconsolata";
};
}
);
confBase = "${config.users.users.${user}.home}/.config";
userDirArgs = {
mode = "0700";
user = user;
group = "users";
};
in
{
"${confBase}".d = userDirArgs;
"${confBase}/terminal.ubports".d = userDirArgs;
"${confBase}/terminal.ubports/customized.colorscheme".L.argument = "${terminalColors}";
"${confBase}/terminal.ubports/terminal.ubports.conf".L.argument = "${terminalConfig}";
};
in
{
greeter = makeTest (
Expand Down Expand Up @@ -154,47 +200,9 @@ in
};

# Help with OCR
systemd.tmpfiles.settings =
let
white = "255, 255, 255";
black = "0, 0, 0";
colorSection = color: {
Color = color;
Bold = true;
Transparency = false;
};
terminalColors = pkgs.writeText "customized.colorscheme" (
lib.generators.toINI { } {
Background = colorSection white;
Foreground = colorSection black;
Color2 = colorSection black;
Color2Intense = colorSection black;
}
);
terminalConfig = pkgs.writeText "terminal.ubports.conf" (
lib.generators.toINI { } {
General = {
colorScheme = "customized";
fontSize = "16";
fontStyle = "Inconsolata";
};
}
);
confBase = "${config.users.users.${user}.home}/.config";
userDirArgs = {
mode = "0700";
user = user;
group = "users";
};
in
{
"10-lomiri-test-setup" = {
"${confBase}".d = userDirArgs;
"${confBase}/terminal.ubports".d = userDirArgs;
"${confBase}/terminal.ubports/customized.colorscheme".L.argument = "${terminalColors}";
"${confBase}/terminal.ubports/terminal.ubports.conf".L.argument = "${terminalConfig}";
};
};
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};

enableOCR = true;
Expand Down Expand Up @@ -360,58 +368,20 @@ in
};

variables = {
# So we can test what content-hub is working behind the scenes
CONTENT_HUB_LOGGING_LEVEL = "2";
# So we can test what lomiri-content-hub is working behind the scenes
LOMIRI_CONTENT_HUB_LOGGING_LEVEL = "2";
};

systemPackages = with pkgs; [
# For a convenient way of kicking off content-hub peer collection
lomiri.content-hub.examples
# For a convenient way of kicking off lomiri-content-hub peer collection
lomiri.lomiri-content-hub.examples
];
};

# Help with OCR
systemd.tmpfiles.settings =
let
white = "255, 255, 255";
black = "0, 0, 0";
colorSection = color: {
Color = color;
Bold = true;
Transparency = false;
};
terminalColors = pkgs.writeText "customized.colorscheme" (
lib.generators.toINI { } {
Background = colorSection white;
Foreground = colorSection black;
Color2 = colorSection black;
Color2Intense = colorSection black;
}
);
terminalConfig = pkgs.writeText "terminal.ubports.conf" (
lib.generators.toINI { } {
General = {
colorScheme = "customized";
fontSize = "16";
fontStyle = "Inconsolata";
};
}
);
confBase = "${config.users.users.${user}.home}/.config";
userDirArgs = {
mode = "0700";
user = user;
group = "users";
};
in
{
"10-lomiri-test-setup" = {
"${confBase}".d = userDirArgs;
"${confBase}/terminal.ubports".d = userDirArgs;
"${confBase}/terminal.ubports/customized.colorscheme".L.argument = "${terminalColors}";
"${confBase}/terminal.ubports/terminal.ubports.conf".L.argument = "${terminalConfig}";
};
};
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};

enableOCR = true;
Expand Down Expand Up @@ -484,9 +454,9 @@ in
# lomiri-terminal-app has a separate VM test to test its basic functionality
# for the LSS content-hub test to work reliably, we need to kick off peer collecting
machine.send_chars("content-hub-test-importer\n")
wait_for_text(r"(/build/source|hub.cpp|handler.cpp|void|virtual|const)") # awaiting log messages from content-hub
# for the LSS lomiri-content-hub test to work reliably, we need to kick off peer collecting
machine.send_chars("lomiri-content-hub-test-importer\n")
wait_for_text(r"(/build/source|hub.cpp|handler.cpp|void|virtual|const)") # awaiting log messages from lomiri-content-hub
machine.send_key("ctrl-c")
# Doing this here, since we need an in-session shell & separately starting a terminal again wastes time
Expand All @@ -510,7 +480,7 @@ in
wait_for_text("Rotation Lock")
machine.screenshot("settings_open")
# lomiri-system-settings has a separate VM test, only test Lomiri-specific content-hub functionalities here
# lomiri-system-settings has a separate VM test, only test Lomiri-specific lomiri-content-hub functionalities here
# Make fullscreen, can't navigate to Background plugin via keyboard unless window has non-phone-like aspect ratio
toggle_maximise()
Expand All @@ -536,19 +506,19 @@ in
# Peers should be loaded
wait_for_text("Morph") # or Gallery, but Morph is already packaged
machine.screenshot("settings_content-hub_peers")
machine.screenshot("settings_lomiri-content-hub_peers")
# Select Morph as content source
mouse_click(370, 100)
# Expect Morph to be brought into the foreground, with its Downloads page open
wait_for_text("No downloads")
# If content-hub encounters a problem, it may have crashed the original application issuing the request.
# If lomiri-content-hub encounters a problem, it may have crashed the original application issuing the request.
# Check that it's still alive
machine.succeed("pgrep -u ${user} -f lomiri-system-settings")
machine.screenshot("content-hub_exchange")
machine.screenshot("lomiri-content-hub_exchange")
# Testing any more would require more applications & setup, the fact that it's already being attempted is a good sign
machine.send_key("esc")
Expand Down Expand Up @@ -732,8 +702,17 @@ in
# Help with OCR
fonts.packages = [ pkgs.inconsolata ];

# Non-QWERTY keymap to test keymap patch
services.xserver.xkb.layout = "de";
services.xserver.xkb.layout = lib.strings.concatStringsSep "," [
# Start with a non-QWERTY keymap to test keymap patch
"de"
# Then a QWERTY one to test switching
"us"
];

# Help with OCR
systemd.tmpfiles.settings = {
"10-lomiri-test-setup" = terminalOcrTmpfilesSetup { inherit pkgs lib config; };
};
};

enableOCR = true;
Expand Down Expand Up @@ -784,6 +763,30 @@ in
machine.send_chars("touch ${pwInput}\n")
machine.wait_for_file("/home/alice/${pwOutput}", 10)
# Issues with this keybind: input leaks to focused surface, may open launcher
# Don't have the keyboard indicator to handle this better
machine.send_key("meta_l-spc")
machine.wait_for_console_text('SET KEYMAP "us"')
# Handle keybind fallout
machine.sleep(10) # wait for everything to settle
machine.send_key("esc") # close launcher in case it was opened
machine.sleep(2) # wait for animation to finish
# Make sure input leaks are gone
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_key("backspace")
machine.send_chars("touch ${pwInput}\n")
machine.wait_for_file("/home/alice/${pwInput}", 10)
machine.send_key("alt-f4")
'';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
gitUpdater,
nixosTests,
cmake,
content-hub,
exiv2,
gettext,
gst_all_1,
libusermetrics,
lomiri-action-api,
lomiri-content-hub,
lomiri-ui-toolkit,
lomiri-thumbnailer,
pkg-config,
Expand Down Expand Up @@ -145,9 +145,9 @@ stdenv.mkDerivation (finalAttrs: {
qzxing

# QML
content-hub
libusermetrics
lomiri-action-api
lomiri-content-hub
lomiri-ui-toolkit
lomiri-thumbnailer
qtpositioning
Expand Down Expand Up @@ -192,7 +192,7 @@ stdenv.mkDerivation (finalAttrs: {
export QML2_IMPORT_PATH=${
listToQtVar qtbase.qtQmlPrefix [
lomiri-ui-toolkit
content-hub
lomiri-content-hub
lomiri-thumbnailer
]
}
Expand All @@ -203,7 +203,7 @@ stdenv.mkDerivation (finalAttrs: {
ln -s $out/share/lomiri-camera-app/assets/lomiri-camera-app-splash.svg $out/share/lomiri-app-launch/splash/lomiri-camera-app.svg
ln -s $out/share/lomiri-camera-app/assets/lomiri-barcode-reader-app-splash.svg $out/share/lomiri-app-launch/splash/lomiri-barcode-reader-app.svg
install -Dm644 ../camera-contenthub.json $out/share/content-hub/peers/lomiri-camera-app
install -Dm644 ../camera-contenthub.json $out/share/lomiri-content-hub/peers/lomiri-camera-app
'';

dontWrapGApps = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
gitUpdater,
nixosTests,
cmake,
content-hub,
geonames,
gettext,
libusermetrics,
lomiri-content-hub,
lomiri-sounds,
lomiri-ui-toolkit,
makeWrapper,
Expand Down Expand Up @@ -124,8 +124,8 @@ stdenv.mkDerivation (finalAttrs: {
qtbase

# QML
content-hub
libusermetrics
lomiri-content-hub
lomiri-ui-toolkit
qtdeclarative
qtmultimedia
Expand Down Expand Up @@ -172,7 +172,7 @@ stdenv.mkDerivation (finalAttrs: {
export QML2_IMPORT_PATH=${
listToQtVar qtbase.qtQmlPrefix (
[
content-hub
lomiri-content-hub
lomiri-ui-toolkit
qtmultimedia
u1db-qt
Expand Down
Loading

0 comments on commit e58a261

Please sign in to comment.