Merge pull request #121345 from samueldr/feature/plasma-mobile

Add support for Plasma Mobile
This commit is contained in:
Samuel Dionne-Riel
2021-12-04 15:37:26 -05:00
committed by GitHub
10 changed files with 451 additions and 39 deletions
@@ -4,6 +4,28 @@ let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager.plasma5;
# Use only for **internal** options.
# This is not exactly user-friendly.
kdeConfigurationType = with types;
let
valueTypes = (oneOf [
bool
float
int
str
]) // {
description = "KDE Configuration value";
emptyValue.value = "";
};
set = (nullOr (lazyAttrsOf valueTypes)) // {
description = "KDE Configuration set";
emptyValue.value = {};
};
in (lazyAttrsOf set) // {
description = "KDE Configuration file";
emptyValue.value = {};
};
libsForQt5 = pkgs.plasma5Packages;
inherit (libsForQt5) kdeGear kdeFrameworks plasma5;
inherit (pkgs) writeText;
@@ -169,6 +191,37 @@ in
type = types.bool;
default = false;
};
# Internally allows configuring kdeglobals globally
kdeglobals = mkOption {
internal = true;
default = {};
type = kdeConfigurationType;
};
# Internally allows configuring kwin globally
kwinrc = mkOption {
internal = true;
default = {};
type = kdeConfigurationType;
};
mobile.enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable support for running the Plasma Mobile shell.
'';
};
mobile.installRecommendedSoftware = mkOption {
type = types.bool;
default = true;
description = ''
Installs software recommended for use with Plasma Mobile, but which
is not strictly required for Plasma Mobile to run.
'';
};
};
imports = [
@@ -177,22 +230,8 @@ in
];
config = mkMerge [
(mkIf cfg.enable {
# Seed our configuration into nixos-generate-config
system.nixos-generate-config.desktopConfiguration = [
''
# Enable the Plasma 5 Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
''
];
services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-workspace ];
# Default to be `plasma` (X11) instead of `plasmawayland`, since plasma wayland currently has
# many tiny bugs.
# See: https://github.com/NixOS/nixpkgs/issues/143272
services.xserver.displayManager.defaultSession = mkDefault "plasma";
# Common Plasma dependencies
(mkIf (cfg.enable || cfg.mobile.enable) {
security.wrappers = {
kcheckpass = {
@@ -278,37 +317,24 @@ in
kdeplasma-addons
kgamma5
khotkeys
kinfocenter
kmenuedit
kscreen
kscreenlocker
ksystemstats
kwayland
kwin
kwrited
libkscreen
libksysguard
milou
plasma-systemmonitor
plasma-browser-integration
plasma-integration
polkit-kde-agent
spectacle
systemsettings
plasma-desktop
plasma-workspace
plasma-workspace-wallpapers
dolphin
dolphin-plugins
ffmpegthumbs
kdegraphics-thumbnailers
khelpcenter
kio-extras
konsole
oxygen
print-manager
breeze-icons
pkgs.hicolor-icon-theme
@@ -319,10 +345,6 @@ in
qtvirtualkeyboard
pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
elisa
gwenview
okular
]
# Phonon audio backend
@@ -396,7 +418,67 @@ in
serviceConfig.Type = "oneshot";
script = activationScript;
};
};
xdg.portal.enable = true;
xdg.portal.extraPortals = [ plasma5.xdg-desktop-portal-kde ];
# Update the start menu for each user that is currently logged in
system.userActivationScripts.plasmaSetup = activationScript;
services.xserver.displayManager.setupCommands = startplasma;
nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
environment.etc = {
"xdg/kwinrc".text = lib.generators.toINI {} cfg.kwinrc;
"xdg/kdeglobals".text = lib.generators.toINI {} cfg.kdeglobals;
};
})
# Plasma Desktop
(mkIf cfg.enable {
# Seed our configuration into nixos-generate-config
system.nixos-generate-config.desktopConfiguration = [
''
# Enable the Plasma 5 Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
''
];
services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-workspace ];
# Default to be `plasma` (X11) instead of `plasmawayland`, since plasma wayland currently has
# many tiny bugs.
# See: https://github.com/NixOS/nixpkgs/issues/143272
services.xserver.displayManager.defaultSession = mkDefault "plasma";
environment.systemPackages =
with libsForQt5;
with plasma5; with kdeGear; with kdeFrameworks;
[
ksystemstats
kinfocenter
kmenuedit
plasma-systemmonitor
spectacle
systemsettings
dolphin
dolphin-plugins
ffmpegthumbs
kdegraphics-thumbnailers
khelpcenter
kio-extras
print-manager
elisa
gwenview
okular
]
;
systemd.user.services = {
plasma-run-with-systemd = {
description = "Run KDE Plasma via systemd";
wantedBy = [ "basic.target" ];
@@ -409,15 +491,88 @@ in
'';
};
};
})
xdg.portal.enable = true;
xdg.portal.extraPortals = [ plasma5.xdg-desktop-portal-kde ];
# Plasma Mobile
(mkIf cfg.mobile.enable {
assertions = [
{
# The user interface breaks without NetworkManager
assertion = config.networking.networkmanager.enable;
message = "Plasma Mobile requires NetworkManager.";
}
{
# The user interface breaks without bluetooth
assertion = config.hardware.bluetooth.enable;
message = "Plasma Mobile requires Bluetooth.";
}
{
# The user interface breaks without pulse
assertion = config.hardware.pulseaudio.enable;
message = "Plasma Mobile requires pulseaudio.";
}
];
# Update the start menu for each user that is currently logged in
system.userActivationScripts.plasmaSetup = activationScript;
services.xserver.displayManager.setupCommands = startplasma;
environment.systemPackages =
with libsForQt5;
with plasma5; with kdeApplications; with kdeFrameworks;
[
# Basic packages without which Plasma Mobile fails to work properly.
plasma-phone-components
plasma-nano
pkgs.maliit-framework
pkgs.maliit-keyboard
]
++ lib.optionals (cfg.mobile.installRecommendedSoftware) (with libsForQt5.plasmaMobileGear;[
# Additional software made for Plasma Mobile.
alligator
angelfish
audiotube
calindori
kalk
kasts
kclock
keysmith
koko
krecorder
ktrip
kweather
plasma-dialer
plasma-phonebook
plasma-settings
spacebar
])
;
nixpkgs.config.firefox.enablePlasmaBrowserIntegration = true;
# The following services are needed or the UI is broken.
hardware.bluetooth.enable = true;
hardware.pulseaudio.enable = true;
networking.networkmanager.enable = true;
# Recommendations can be found here:
# - https://invent.kde.org/plasma-mobile/plasma-phone-settings/-/tree/master/etc/xdg
# This configuration is the minimum required for Plasma Mobile to *work*.
services.xserver.desktopManager.plasma5 = {
kdeglobals = {
KDE = {
# This forces a numeric PIN for the lockscreen, which is the
# recommendation from upstream.
LookAndFeelPackage = lib.mkDefault "org.kde.plasma.phone";
};
};
kwinrc = {
Windows = {
# Forces windows to be maximized
Placement = lib.mkDefault "Maximizing";
};
"org.kde.kdecoration2" = {
# No decorations (title bar)
NoPlugin = lib.mkDefault "true";
};
};
};
services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-phone-components ];
})
];
}
@@ -0,0 +1,68 @@
{ mkDerivation
, lib
, fetchFromGitHub
, at-spi2-atk
, at-spi2-core
, libepoxy
, gtk3
, libdatrie
, libselinux
, libsepol
, libthai
, pcre
, util-linux
, wayland
, xorg
, cmake
, doxygen
, pkg-config
, wayland-protocols
}:
mkDerivation rec {
pname = "maliit-framework";
version = "2.0.0";
src = fetchFromGitHub {
owner = "maliit";
repo = "framework";
rev = version;
sha256 = "138jyvw130kmrldksbk4l38gvvahh3x51zi4vyplad0z5nxmbazb";
};
buildInputs = [
at-spi2-atk
at-spi2-core
libepoxy
gtk3
libdatrie
libselinux
libsepol
libthai
pcre
util-linux
wayland
xorg.libXdmcp
xorg.libXtst
];
nativeBuildInputs = [
cmake
doxygen
pkg-config
wayland-protocols
];
preConfigure = ''
cmakeFlags+="-DQT5_PLUGINS_INSTALL_DIR=$out/$qtPluginPrefix"
'';
meta = with lib; {
description = "Core libraries of Maliit and server";
homepage = "http://maliit.github.io/";
license = licenses.lgpl21Plus;
maintainers = with maintainers; [ samueldr ];
};
}
@@ -0,0 +1,82 @@
{ mkDerivation
, lib
, fetchFromGitHub
, fetchpatch
, anthy
, hunspell
, libchewing
, libpinyin
, maliit-framework
, pcre
, presage
, qtfeedback
, qtmultimedia
, qtquickcontrols2
, qtgraphicaleffects
, cmake
, pkg-config
, wrapGAppsHook
}:
mkDerivation rec {
pname = "maliit-keyboard";
version = "2.0.0";
src = fetchFromGitHub {
owner = "maliit";
repo = "keyboard";
rev = version;
sha256 = "10dh0abxq90024dqq3fs8mjxww3igb4l09d19i2fq9f3flvh11hc";
};
patches = [
(fetchpatch {
# https://github.com/maliit/keyboard/pull/34
url = "https://github.com/maliit/keyboard/commit/9848a73b737ad46b5790ebf713a559d340c91b82.patch";
sha256 = "0qrsga0npahjrgbl6mycvl6d6vjm0d17i5jadcn7y6khbhq2y6rg";
})
];
postPatch = ''
substituteInPlace data/schemas/org.maliit.keyboard.maliit.gschema.xml \
--replace /usr/share "$out/share"
'';
buildInputs = [
anthy
hunspell
libchewing
libpinyin
maliit-framework
pcre
presage
qtfeedback
qtmultimedia
qtquickcontrols2
qtgraphicaleffects
];
cmakeFlags = [
"-DCMAKE_INSTALL_PREFIX=${placeholder "out"}"
"-DCMAKE_INSTALL_LIBDIR=lib"
];
nativeBuildInputs = [
cmake
pkg-config
wrapGAppsHook
];
postInstall = ''
glib-compile-schemas "$out"/share/glib-2.0/schemas
'';
meta = with lib; {
description = "Virtual keyboard";
homepage = "http://maliit.github.io/";
license = with licenses; [ lgpl3Only bsd3 cc-by-30 ];
maintainers = with maintainers; [ samueldr ];
};
}
@@ -75,6 +75,7 @@ let
kweather = callPackage ./kweather.nix {};
plasma-dialer = callPackage ./plasma-dialer.nix {};
plasma-phonebook = callPackage ./plasma-phonebook.nix {};
plasma-settings = callPackage ./plasma-settings.nix {};
spacebar = callPackage ./spacebar.nix {};
};
@@ -0,0 +1,42 @@
{ lib
, mkDerivation
, fetchFromGitLab
, cmake
, extra-cmake-modules
, kauth
, kconfig
, kcoreaddons
, kdbusaddons
, ki18n
, kitemmodels
, plasma-framework
}:
mkDerivation rec {
pname = "plasma-settings";
nativeBuildInputs = [
cmake
extra-cmake-modules
];
buildInputs = [
kauth
kconfig
kcoreaddons
kdbusaddons
ki18n
kitemmodels
plasma-framework
];
meta = with lib; {
description = "Settings application for Plasma Mobile";
homepage = "https://invent.kde.org/plasma-mobile/plasma-settings";
# https://invent.kde.org/plasma-mobile/plasma-settings/-/commit/a59007f383308503e59498b3036e1483bca26e35
license = licenses.gpl2Plus;
maintainers = with maintainers; [ samueldr ];
};
}
+2
View File
@@ -134,9 +134,11 @@ let
milou = callPackage ./milou.nix {};
oxygen = callPackage ./oxygen.nix {};
plasma-browser-integration = callPackage ./plasma-browser-integration.nix {};
plasma-phone-components = callPackage ./plasma-phone-components {};
plasma-desktop = callPackage ./plasma-desktop {};
plasma-disks = callPackage ./plasma-disks.nix {};
plasma-integration = callPackage ./plasma-integration {};
plasma-nano = callPackage ./plasma-nano {};
plasma-nm = callPackage ./plasma-nm {};
plasma-pa = callPackage ./plasma-pa.nix { inherit gconf; };
plasma-sdk = callPackage ./plasma-sdk.nix {};
@@ -0,0 +1,13 @@
{
mkDerivation,
extra-cmake-modules,
plasma-framework
}:
mkDerivation {
name = "plasma-nano";
nativeBuildInputs = [ extra-cmake-modules ];
buildInputs = [
plasma-framework
];
}
@@ -0,0 +1,43 @@
{
mkDerivation, lib,
extra-cmake-modules, kdoctools,
coreutils, dbus, gnugrep, gnused, libdbusmenu, pam, wayland, appstream,
kdeclarative, kdelibs4support, kpeople, kconfig, krunner, kinit, kwayland, kwin,
plasma-framework, telepathy, libphonenumber, protobuf, libqofono, modemmanager-qt,
plasma-workspace,
maliit-framework, maliit-keyboard,
qtwayland, qttools
}:
let inherit (lib) getBin getLib; in
mkDerivation {
name = "plasma-phone-components";
nativeBuildInputs = [ extra-cmake-modules kdoctools ];
buildInputs = [
appstream libdbusmenu pam wayland
kdeclarative kdelibs4support kpeople kconfig krunner kinit kwayland kwin
plasma-framework telepathy libphonenumber protobuf libqofono modemmanager-qt
maliit-framework maliit-keyboard
];
postPatch = ''
substituteInPlace bin/kwinwrapper.in \
--replace @KDE_INSTALL_FULL_LIBEXECDIR@ "${plasma-workspace}/libexec"
substituteInPlace bin/plasma-mobile.desktop.cmake \
--replace @CMAKE_INSTALL_FULL_LIBEXECDIR@ "${plasma-workspace}/libexec"
'';
# Ensures dependencies like libqofono (at the very least) are present for the shell.
preFixup = ''
wrapQtApp "$out/bin/kwinwrapper"
'';
passthru.providedSessions = [ "plasma-mobile" ];
}
+2
View File
@@ -1217,6 +1217,8 @@ mapAliases ({
qqc2-breeze-style
sddm-kcm systemsettings
xdg-desktop-portal-kde
plasma-phone-components
plasma-nano
;
inherit (plasma5Packages.thirdParty)
plasma-applet-caffeine-plus
+4
View File
@@ -3292,6 +3292,10 @@ with pkgs;
maigret = callPackage ../tools/security/maigret { };
maliit-framework = libsForQt5.callPackage ../applications/misc/maliit-framework { };
maliit-keyboard = libsForQt5.callPackage ../applications/misc/maliit-keyboard { };
mapcidr = callPackage ../tools/misc/mapcidr { };
mapproxy = callPackage ../applications/misc/mapproxy { };