summary refs log tree commit diff
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2021-03-10 15:26:11 -0500
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2021-12-03 20:17:04 -0500
commitb41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f (patch)
tree445570d0d20e32d48aeed9159f727d81a28c7196
parentda6a39436b20d9aecbb32b863ac8a97a2e8f4941 (diff)
downloadnixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar.gz
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar.bz2
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar.lz
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar.xz
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.tar.zst
nixpkgs-b41923c1ca353d750cc2cf7bcec9c0c3ca4e3b2f.zip
nixos/plasma5: configuration for plasma mobile
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix58
1 files changed, 55 insertions, 3 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index 97dac3d3250..e47129898eb 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -373,9 +373,6 @@ in
         ++ lib.optional (cfg.phononBackend == "gstreamer") libsForQt5.phonon-backend-gstreamer
         ++ lib.optional (cfg.phononBackend == "vlc") libsForQt5.phonon-backend-vlc
 
-        # Plasma mobile
-        ++ lib.optional cfg.mobile.enable plasma-phone-components
-
         # Optional hardware support features
         ++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt pkgs.openobex pkgs.obexftp ]
         ++ lib.optional config.networking.networkmanager.enable plasma-nm
@@ -471,5 +468,60 @@ in
         "xdg/kdeglobals".text = lib.generators.toINI {} cfg.kdeglobals;
       };
     })
+    (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.";
+        }
+      ];
+
+      environment.systemPackages =
+        with libsForQt5;
+        with plasma5; with kdeApplications; with kdeFrameworks;
+        [
+          plasma-phone-components
+          plasma-nano
+        ];
+
+      # 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";
+          };
+        };
+      };
+    })
   ];
 }