1 { config, pkgs, lib, ... }:
4 cfg = config.services.desktopManager.lomiri;
6 options.services.desktopManager.lomiri = {
7 enable = lib.mkEnableOption ''
8 the Lomiri graphical shell (formerly known as Unity8)
12 config = lib.mkIf cfg.enable {
14 systemPackages = (with pkgs; [
15 glib # XDG MIME-related tools identify it as GNOME, add gio for MIME identification to work
18 ]) ++ (with pkgs.lomiri; [
28 lomiri-download-manager
29 lomiri-filemanager-app
32 lomiri-schemas # exposes some required dbus interfaces
33 lomiri-session # wrappers to properly launch the session
35 lomiri-system-settings
40 mediascanner2 # TODO possibly needs to be kicked off by graphical-session.target
42 qtmir # not having its desktop file for Xwayland available causes any X11 application to crash the session
48 # To override the keyboard layouts in Lomiri
49 NIXOS_XKB_LAYOUTS = config.services.xserver.xkb.layout;
54 bluetooth.enable = lib.mkDefault true;
57 networking.networkmanager.enable = lib.mkDefault true;
59 systemd.packages = with pkgs.lomiri; [
61 lomiri-download-manager
64 services.dbus.packages = with pkgs.lomiri; [
67 lomiri-download-manager
70 fonts.packages = with pkgs; [
71 # Applications tend to default to Ubuntu font
75 # Copy-pasted basic stuff
76 hardware.graphics.enable = lib.mkDefault true;
77 fonts.enableDefaultPackages = lib.mkDefault true;
78 programs.dconf.enable = lib.mkDefault true;
80 # Xwayland is partly hardcoded in Mir so it can't really be fully turned off, and it must be on PATH for X11 apps *and Lomiri's web browser* to work.
81 # Until Mir/Lomiri can be properly used without it, force it on so everything behaves as expected.
82 programs.xwayland.enable = lib.mkForce true;
84 services.accounts-daemon.enable = true;
86 services.ayatana-indicators = {
88 packages = (with pkgs; [
89 ayatana-indicator-datetime
90 ayatana-indicator-display
91 ayatana-indicator-messages
92 ayatana-indicator-power
93 ayatana-indicator-session
94 ] ++ lib.optionals config.hardware.bluetooth.enable [
95 ayatana-indicator-bluetooth
96 ] ++ lib.optionals (config.hardware.pulseaudio.enable || config.services.pipewire.pulse.enable) [
97 ayatana-indicator-sound
98 ]) ++ (with pkgs.lomiri; [
100 ] ++ lib.optionals config.networking.networkmanager.enable [
101 lomiri-indicator-network
105 services.udisks2.enable = true;
106 services.upower.enable = true;
107 services.geoclue2.enable = true;
109 services.gnome.evolution-data-server = {
111 plugins = with pkgs; [
112 # TODO: lomiri.address-book-service
116 services.telepathy.enable = true;
118 services.displayManager = {
119 defaultSession = lib.mkDefault "lomiri";
120 sessionPackages = with pkgs.lomiri; [ lomiri-session ];
124 enable = lib.mkDefault true;
125 displayManager.lightdm = {
126 enable = lib.mkDefault true;
127 greeters.lomiri.enable = lib.mkDefault true;
131 environment.pathsToLink = [
132 # Configs for inter-app data exchange system
133 "/share/content-hub/peers"
134 # Configs for inter-app URL requests
135 "/share/lomiri-url-dispatcher/urls"
136 # Splash screens & other images for desktop apps launched via lomiri-app-launch
137 "/share/lomiri-app-launch"
138 # TODO Try to get maliit stuff working
139 "/share/maliit/plugins"
140 # At least the network indicator is still under the unity name, due to leftover Unity-isms
143 "/share/locale" # TODO LUITK hardcoded default locale path, fix individual apps to not rely on it
148 systemd.user.services = {
149 # Unconditionally run service that collects system-installed URL handlers before LUD
150 # TODO also run user-installed one?
151 "lomiri-url-dispatcher-update-system-dir" = {
152 description = "Lomiri URL dispatcher system directory updater";
153 wantedBy = [ "lomiri-url-dispatcher.service" ];
154 before = [ "lomiri-url-dispatcher.service" ];
157 ExecStart = "${pkgs.lomiri.lomiri-url-dispatcher}/libexec/lomiri-url-dispatcher/lomiri-update-directory /run/current-system/sw/share/lomiri-url-dispatcher/urls/";
161 "lomiri-polkit-agent" = rec {
162 description = "Lomiri Polkit agent";
163 wantedBy = [ "lomiri.service" "lomiri-full-greeter.service" "lomiri-full-shell.service" "lomiri-greeter.service" "lomiri-shell.service" ];
164 after = [ "graphical-session.target" ];
169 ExecStart = "${pkgs.lomiri.lomiri-polkit-agent}/libexec/lomiri-polkit-agent/policykit-agent";
175 "dbus-com.lomiri.UserMetrics" = {
178 BusName = "com.lomiri.UserMetrics";
179 User = "usermetrics";
180 StandardOutput = "syslog";
181 SyslogIdentifier = "com.lomiri.UserMetrics";
182 ExecStart = "${pkgs.lomiri.libusermetrics}/libexec/libusermetrics/usermetricsservice";
183 } // lib.optionalAttrs (!config.security.apparmor.enable) {
184 # Due to https://gitlab.com/ubports/development/core/libusermetrics/-/issues/8, auth must be disabled when not using AppArmor, lest the next database usage breaks
185 Environment = "USERMETRICS_NO_AUTH=1";
190 users.users.usermetrics = {
191 group = "usermetrics";
192 home = "/var/lib/usermetrics";
197 users.groups.usermetrics = { };
199 # 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?
200 # 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.
201 # security.apparmor.enable = true;
204 meta.maintainers = lib.teams.lomiri.members;