Skip to content

Commit

Permalink
Merge pull request #324663 from OPNA2608/init/lomiri/teleports
Browse files Browse the repository at this point in the history
lomiri.teleports: init at 1.20
  • Loading branch information
SuperSandro2000 authored Jul 14, 2024
2 parents d20f0c3 + 77aaa06 commit 77ee426
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
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 @@ -39,6 +39,7 @@ in {
qtmir # not having its desktop file for Xwayland available causes any X11 application to crash the session
suru-icon-theme
telephony-service
teleports
]);
variables = {
# To override the keyboard layouts in Lomiri
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 @@ -976,6 +976,7 @@ in {
teeworlds = handleTest ./teeworlds.nix {};
telegraf = handleTest ./telegraf.nix {};
teleport = handleTest ./teleport.nix {};
teleports = runTest ./teleports.nix;
thelounge = handleTest ./thelounge.nix {};
terminal-emulators = handleTest ./terminal-emulators.nix {};
thanos = handleTest ./thanos.nix {};
Expand Down
48 changes: 48 additions & 0 deletions nixos/tests/teleports.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{ pkgs, lib, ... }:
{
name = "teleports-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
teleports
];
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("teleports launches"):
machine.execute("teleports >&2 &")
machine.wait_for_text(r"(TELEports|Phone Number)")
machine.screenshot("teleports_open")
machine.succeed("pkill -f teleports")
with subtest("teleports localisation works"):
machine.execute("env LANG=de_DE.UTF-8 teleports >&2 &")
machine.wait_for_text("Telefonnummer")
machine.screenshot("teleports_localised")
'';
}
133 changes: 133 additions & 0 deletions pkgs/desktops/lomiri/applications/teleports/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
stdenv,
lib,
fetchFromGitHub,
fetchFromGitLab,
fetchpatch,
gitUpdater,
nixosTests,
cmake,
content-hub,
intltool,
lomiri-indicator-network,
lomiri-push-qml,
lomiri-thumbnailer,
lomiri-ui-toolkit,
pkg-config,
qqc2-suru-style,
qtbase,
qtmultimedia,
qtpositioning,
qtquickcontrols2,
quazip,
quickflux,
rlottie,
rlottie-qml,
tdlib,
wrapQtAppsHook,
}:

let
tdlib-1811 = tdlib.overrideAttrs (
oa: fa: {
version = "1.8.11";
src = fetchFromGitHub {
owner = "tdlib";
repo = "td";
rev = "3179d35694a28267a0b6273fc9b5bdce3b6b1235";
hash = "sha256-XvqqDXaFclWK/XpIxOqAXQ9gcc/dTljl841CN0KrlyA=";
};
}
);
in
stdenv.mkDerivation (finalAttrs: {
pname = "teleports";
version = "1.20";

src = fetchFromGitLab {
owner = "ubports";
repo = "development/apps/teleports";
rev = "v${finalAttrs.version}";
hash = "sha256-hHnQjitBI4RX8DwX1HHicpgAl3pznWN4wC4lkhlh+OI=";
};

patches = [
# Remove when https://gitlab.com/ubports/development/apps/teleports/-/merge_requests/551 merged & in release
(fetchpatch {
name = "0001-teleports-Call-i18n.bindtextdomain.patch";
url = "https://gitlab.com/ubports/development/apps/teleports/-/commit/dd537c08453be9bfcdb2ee1eb692514c7e867e41.patch";
hash = "sha256-zxxFvoj6jluGPCA9GQsxuYYweaSOVrkD01hZwCtq52U=";
})
];

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace-fail 'COMMAND git describe --tags --abbrev=0 --exact-match' 'COMMAND echo v${finalAttrs.version}' \
--replace-fail 'set(DATA_DIR ''${CMAKE_INSTALL_PREFIX})' 'set(DATA_DIR ''${CMAKE_INSTALL_FULL_DATADIR}/teleports)'
# Doesn't honour DATA_DIR
substituteInPlace app/main.cpp push/pushhelper.cpp libs/qtdlib/client/qtdclient.cpp \
--replace-fail 'QGuiApplication::applicationDirPath()' "QString(\"$out/share/teleports\")"
substituteInPlace teleports.desktop.in \
--replace-fail 'assets/icon.svg' 'teleports' \
--replace-fail 'assets/splash.svg' 'lomiri-app-launch/splash/teleports.svg'
'';

strictDeps = true;

nativeBuildInputs = [
cmake
intltool
pkg-config
wrapQtAppsHook
];

buildInputs = [
content-hub
lomiri-indicator-network
lomiri-push-qml
lomiri-thumbnailer
lomiri-ui-toolkit
rlottie-qml
qqc2-suru-style
qtbase
qtmultimedia
qtpositioning
qtquickcontrols2
quazip
quickflux
rlottie
tdlib-1811
];

postInstall = ''
mkdir -p $out/share/{applications,content-hub/peers,icons/hicolor/scalable/apps,lomiri-app-launch/splash,lomiri-url-dispatcher/urls}
ln -s $out/share/teleports/teleports.desktop $out/share/applications/teleports.desktop
ln -s $out/share/teleports/teleports.content-hub $out/share/content-hub/peers/teleports
ln -s $out/share/teleports/assets/icon.svg $out/share/icons/hicolor/scalable/apps/teleports.svg
ln -s $out/share/teleports/assets/splash.svg $out/share/lomiri-app-launch/splash/teleports.svg
ln -s $out/share/teleports/teleports.url-dispatcher $out/share/lomiri-url-dispatcher/urls/teleports.url-dispatcher
'';

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

meta = {
description = "Ubuntu Touch Telegram client";
homepage = "https://gitlab.com/ubports/development/apps/teleports";
license = with lib.licenses; [
mit # main
asl20 # benlau/asyncfuture in qtdlib
bsd3 # FastScroll.js from Meego? maybe?
gpl3Only # components
lgpl3Only # components
];
mainProgram = "teleports";
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 @@ -17,6 +17,7 @@ let
lomiri-system-settings = callPackage ./applications/lomiri-system-settings/wrapper.nix { };
lomiri-terminal-app = callPackage ./applications/lomiri-terminal-app { };
morph-browser = callPackage ./applications/morph-browser { };
teleports = callPackage ./applications/teleports { };

#### Data
lomiri-schemas = callPackage ./data/lomiri-schemas { };
Expand Down

0 comments on commit 77ee426

Please sign in to comment.