Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lomiri.lomiri-calculator-app: init at 4.0.2 #321046

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/services/desktop-managers/lomiri.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ in {
history-service
libusermetrics
lomiri
lomiri-calculator-app
lomiri-download-manager
lomiri-filemanager-app
lomiri-schemas # exposes some required dbus interfaces
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ in {
lxd-image-server = handleTest ./lxd-image-server.nix {};
#logstash = handleTest ./logstash.nix {};
lomiri = handleTest ./lomiri.nix {};
lomiri-calculator-app = runTest ./lomiri-calculator-app.nix;
lomiri-filemanager-app = runTest ./lomiri-filemanager-app.nix;
lomiri-system-settings = handleTest ./lomiri-system-settings.nix {};
lorri = handleTest ./lorri/default.nix {};
Expand Down
59 changes: 59 additions & 0 deletions nixos/tests/lomiri-calculator-app.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{ pkgs, lib, ... }:
{
name = "lomiri-calculator-app-standalone";
meta.maintainers = lib.teams.lomiri.members;

nodes.machine =
{ config, pkgs, ... }:
{
imports = [ ./common/x11.nix ];

services.xserver.enable = true;

environment = {
systemPackages = with pkgs.lomiri; [
suru-icon-theme
lomiri-calculator-app
];
variables = {
UITK_ICON_THEME = "suru";
};
};

i18n.supportedLocales = [ "all" ];

fonts.packages = with pkgs; [
# Intended font & helps with OCR
ubuntu_font_family
];
};

enableOCR = true;

testScript = ''
machine.wait_for_x()

with subtest("lomiri calculator launches"):
machine.execute("lomiri-calculator-app >&2 &")
machine.wait_for_text("Calculator")
machine.screenshot("lomiri-calculator")

with subtest("lomiri calculator works"):
machine.send_key("tab") # Fix focus

machine.send_chars("22*16\n")
machine.wait_for_text("352")
machine.screenshot("lomiri-calculator_caninfactdobasicmath")

machine.succeed("pkill -f lomiri-calculator-app")

with subtest("lomiri calculator localisation works"):
machine.execute("env LANG=de_DE.UTF-8 lomiri-calculator-app >&2 &")
machine.wait_for_text("Rechner")
machine.screenshot("lomiri-calculator_localised")

# History of previous run should have loaded
with subtest("lomiri calculator history works"):
machine.wait_for_text("352")
'';
}
108 changes: 108 additions & 0 deletions pkgs/desktops/lomiri/applications/lomiri-calculator-app/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{
stdenv,
lib,
fetchFromGitLab,
fetchpatch,
gitUpdater,
nixosTests,
cmake,
gettext,
lomiri-ui-toolkit,
pkg-config,
qqc2-suru-style,
qtbase,
wrapQtAppsHook,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "lomiri-calculator-app";
version = "4.0.2";

src = fetchFromGitLab {
owner = "ubports";
repo = "development/apps/lomiri-calculator-app";
rev = "v${finalAttrs.version}";
hash = "sha256-NyLEis+rIx2ELUiGrGCeFX/tlt43UgPBkb9aUs1tkgk=";
};

patches = [
# Remove when version > 4.0.2
(fetchpatch {
name = "0001-lomiri-calculator-app-Fix-GNUInstallDirs-variable-concatenations.patch";
url = "https://gitlab.com/ubports/development/apps/lomiri-calculator-app/-/commit/0bd6ef6c3470bcecf90a88e1e5568a5ce5ad6d06.patch";
hash = "sha256-2FCLZ/LY3xTPGDmX+M8LiqlbcNQJu5hulkOf+V+3hWY=";
})

# Remove when version > 4.0.2
# Must apply separately because merge has hunk with changes to new file before hunk that inits said file
(fetchpatch {
name = "0002-lomiri-calculator-app-Migrate-to-C++-app.patch";
url = "https://gitlab.com/ubports/development/apps/lomiri-calculator-app/-/commit/035e5b8000ad1c8149a6b024fa8fed2667fbb659.patch";
hash = "sha256-2BTFOrH/gjIzXBmnTPMi+mPpUA7e/+6O/E3pdxhjZYQ=";
})
(fetchpatch {
name = "0003-lomiri-calculator-app-Call-i18n.bindtextdomain.patch";
url = "https://gitlab.com/ubports/development/apps/lomiri-calculator-app/-/commit/7cb5e56958e41a8f7a51e00d81d9b2bc24de32b0.patch";
hash = "sha256-k/Civ0+SCNDDok9bUdb48FKC+LPlM13ASFP6CbBvBVs=";
})
];

postPatch =
# We don't want absolute paths in desktop files
''
substituteInPlace CMakeLists.txt \
--replace-fail 'ICON ''${LOMIRI-CALCULATOR-APP_DIR}/''${ICON_FILE}' 'ICON ''${APP_HARDCODE}' \
--replace-fail 'SPLASH ''${LOMIRI-CALCULATOR-APP_DIR}/''${SPLASH_FILE}' 'SPLASH lomiri-app-launch/splash/''${APP_HARDCODE}.svg'
''
+ lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
substituteInPlace CMakeLists.txt \
--replace-fail 'add_subdirectory(tests)' ""
'';

strictDeps = true;

nativeBuildInputs = [
cmake
gettext
pkg-config
wrapQtAppsHook
];

buildInputs = [
qtbase

# QML
lomiri-ui-toolkit
qqc2-suru-style
];

cmakeFlags = [
(lib.cmakeBool "CLICK_MODE" false)
(lib.cmakeBool "INSTALL_TESTS" false)
];

# No tests we can actually run (just autopilot)
doCheck = false;

postInstall = ''
mkdir -p $out/share/{icons/hicolor/scalable/apps,lomiri-app-launch/splash}

ln -s $out/share/{lomiri-calculator-app,icons/hicolor/scalable/apps}/lomiri-calculator-app.svg
ln -s $out/share/{lomiri-calculator-app/lomiri-calculator-app-splash.svg,lomiri-app-launch/splash/lomiri-calculator-app.svg}
'';

passthru = {
tests.vm = nixosTests.lomiri-calculator-app;
updateScript = gitUpdater { rev-prefix = "v"; };
};

meta = {
description = "Powerful and easy to use calculator for Ubuntu Touch, with calculations history and formula validation";
homepage = "https://gitlab.com/ubports/development/apps/lomiri-calculator-app";
changelog = "https://gitlab.com/ubports/development/apps/lomiri-calculator-app/-/blob/v${finalAttrs.version}/ChangeLog";
license = lib.licenses.gpl3Only;
mainProgram = "lomiri-calculator-app";
maintainers = lib.teams.lomiri.members;
platforms = lib.platforms.linux;
};
})
1 change: 1 addition & 0 deletions pkgs/desktops/lomiri/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ let
in {
#### Core Apps
lomiri = callPackage ./applications/lomiri { };
lomiri-calculator-app = callPackage ./applications/lomiri-calculator-app { };
lomiri-filemanager-app = callPackage ./applications/lomiri-filemanager-app { };
lomiri-system-settings-unwrapped = callPackage ./applications/lomiri-system-settings { };
lomiri-system-settings-security-privacy = callPackage ./applications/lomiri-system-settings/plugins/lomiri-system-settings-security-privacy.nix { };
Expand Down