blob: a05923fd82b5c795001bf1c4c5abb47bdfa574ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.desktopManager.lomiri;
in
{
options.services.desktopManager.lomiri = {
enable = lib.mkEnableOption ''
the Lomiri graphical shell (formerly known as Unity8)
'';
basics = lib.mkOption {
internal = true;
description = ''
Enable basic things for getting Lomiri working.
'';
type = lib.types.bool;
default = config.services.xserver.displayManager.lightdm.greeters.lomiri.enable || cfg.enable;
};
};
config = lib.mkMerge [
# Basics for getting Lomiri to work
(lib.mkIf cfg.basics {
environment = {
# To override the default keyboard layout in Lomiri
etc.${pkgs.lomiri.lomiri.passthru.etcLayoutsFile}.text =
lib.strings.replaceStrings
[ "," ]
[
"\n"
]
config.services.xserver.xkb.layout;
pathsToLink = [
# Data
"/share/locale" # TODO LUITK hardcoded default locale path, fix individual apps to not rely on it
"/share/wallpapers"
];
systemPackages = with pkgs.lomiri; [
lomiri-wallpapers # default + additional wallpaper
suru-icon-theme # basic indicator icons
];
};
# Override GSettings defaults
programs.dconf = {
enable = true;
profiles.user.databases = [
{
settings = {
"com/lomiri/shell/launcher" = {
logo-picture-uri = "file://${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake-white.svg";
home-button-background-color = "#5277C3";
};
};
lockAll = true;
}
];
};
fonts.packages = with pkgs; [
ubuntu-classic # Ubuntu is default font
];
# 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.
# Until Mir/Lomiri can be properly used without it, force it on so everything behaves as expected.
programs.xwayland.enable = lib.mkForce true;
services.ayatana-indicators = {
enable = true;
packages = (
with pkgs;
[
ayatana-indicator-session # Controls for shutting down etc
]
++ (with lomiri; [
lomiri-indicator-datetime # Clock
])
);
};
})
# Full Lomiri DE
(lib.mkIf cfg.enable {
# We need the basic setup as well
services.desktopManager.lomiri.basics = true;
environment = {
systemPackages =
(with pkgs; [
glib # XDG MIME-related tools identify it as GNOME, add gio for MIME identification to work
libayatana-common
ubports-click
])
# Qt5 qtwebengine is not secure: https://github.com/NixOS/nixpkgs/pull/435067
++ (with pkgs.lomiri-qt6; [
morph-browser
])
++ (with pkgs.lomiri; [
hfd-service
libusermetrics
lomiri
lomiri-calculator-app
lomiri-calendar-app
lomiri-camera-app
lomiri-clock-app
lomiri-content-hub
lomiri-docviewer-app
lomiri-download-manager
lomiri-filemanager-app
lomiri-gallery-app
lomiri-history-service
lomiri-mediaplayer-app
lomiri-music-app
lomiri-polkit-agent
lomiri-schemas # exposes some required dbus interfaces
lomiri-session # wrappers to properly launch the session
lomiri-sounds
lomiri-system-settings
lomiri-telephony-service
lomiri-terminal-app
lomiri-thumbnailer
lomiri-url-dispatcher
mediascanner2 # TODO possibly needs to be kicked off by graphical-session.target
qtmir # not having its desktop file for Xwayland available causes any X11 application to crash the session
teleports
]);
};
hardware = {
bluetooth.enable = lib.mkDefault true;
};
networking.networkmanager.enable = lib.mkDefault true;
systemd.packages = with pkgs.lomiri; [
hfd-service
lomiri-download-manager
];
services.dbus.packages = with pkgs.lomiri; [
hfd-service
libusermetrics
lomiri-download-manager
];
services.accounts-daemon.enable = true;
services.udisks2.enable = true;
services.upower.enable = true;
services.geoclue2.enable = true;
services.telepathy.enable = true;
services.ayatana-indicators = {
enable = true;
packages =
(
with pkgs;
[
ayatana-indicator-display
ayatana-indicator-messages
ayatana-indicator-power
]
++ lib.optionals config.hardware.bluetooth.enable [ ayatana-indicator-bluetooth ]
++ lib.optionals (config.services.pulseaudio.enable || config.services.pipewire.pulse.enable) [
ayatana-indicator-sound
]
)
++ (
with pkgs.lomiri;
[ lomiri-telephony-service ]
++ lib.optionals config.networking.networkmanager.enable [ lomiri-indicator-network ]
);
};
services.gnome.evolution-data-server = {
enable = true;
plugins = [
# TODO: lomiri.address-book-service
];
};
services.displayManager = {
defaultSession = lib.mkDefault "lomiri";
sessionPackages = with pkgs.lomiri; [ lomiri-session ];
};
services.xserver = {
enable = lib.mkDefault true;
displayManager.lightdm = {
enable = lib.mkDefault true;
greeters.lomiri.enable = lib.mkDefault true;
};
};
environment.pathsToLink = [
# Configs for inter-app data exchange system
"/share/lomiri-content-hub/peers"
# Configs for inter-app URL requests
"/share/lomiri-url-dispatcher/urls"
# Splash screens & other images for desktop apps launched via lomiri-app-launch
"/share/lomiri-app-launch"
# TODO Try to get maliit stuff working
"/share/maliit/plugins"
# At least the network indicator is still under the unity name, due to leftover Unity-isms
"/share/unity"
# Data
"/share/sounds"
];
systemd.user.services =
let
lomiriService = "lomiri.service";
lomiriServiceNames = [
lomiriService
"lomiri-full-greeter.service"
"lomiri-full-shell.service"
"lomiri-greeter.service"
"lomiri-shell.service"
];
in
{
# Unconditionally run service that collects system-installed URL handlers before LUD
# TODO also run user-installed one?
"lomiri-url-dispatcher-update-system-dir" = {
description = "Lomiri URL dispatcher system directory updater";
wantedBy = [ "lomiri-url-dispatcher.service" ];
before = [ "lomiri-url-dispatcher.service" ];
serviceConfig = {
Type = "oneshot";
ExecStart = "${pkgs.lomiri.lomiri-url-dispatcher}/libexec/lomiri-url-dispatcher/lomiri-update-directory /run/current-system/sw/share/lomiri-url-dispatcher/urls/";
};
};
"lomiri-polkit-agent" = {
description = "Lomiri Polkit agent";
wantedBy = [ lomiriService ];
after = [ lomiriService ];
partOf = [ lomiriService ];
serviceConfig = {
Type = "simple";
Restart = "always";
ExecStart = "${pkgs.lomiri.lomiri-polkit-agent}/libexec/lomiri-polkit-agent/policykit-agent";
};
};
"mediascanner-2.0" = {
description = "Media Scanner";
wantedBy = lomiriServiceNames;
before = lomiriServiceNames;
partOf = lomiriServiceNames;
serviceConfig = {
Type = "dbus";
BusName = "com.lomiri.MediaScanner2.Daemon";
Restart = "on-failure";
ExecStart = "${lib.getExe pkgs.lomiri.mediascanner2}";
};
};
};
systemd.services = {
"dbus-com.lomiri.UserMetrics" = {
serviceConfig = {
Type = "dbus";
BusName = "com.lomiri.UserMetrics";
User = "usermetrics";
StandardOutput = "syslog";
SyslogIdentifier = "com.lomiri.UserMetrics";
ExecStart = "${pkgs.lomiri.libusermetrics}/libexec/libusermetrics/usermetricsservice";
}
// lib.optionalAttrs (!config.security.apparmor.enable) {
# 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
Environment = "USERMETRICS_NO_AUTH=1";
};
};
};
users.users.usermetrics = {
group = "usermetrics";
home = "/var/lib/usermetrics";
createHome = true;
isSystemUser = true;
};
users.groups.usermetrics = { };
})
];
meta.teams = [ lib.teams.lomiri ];
}
|