2023-12-03 13:58:30 +00:00
|
|
|
# TODO(bug): signal-desktop is known to hang on exit.
|
|
|
|
# particularly, it may fail to start (because e.g. there's no wayland session yet),
|
|
|
|
# and it will try to exit -- after which the service would restart -- but it hangs w/ no GUI instead.
|
|
|
|
# characterized by these log messages:
|
|
|
|
#
|
|
|
|
# Dec 03 13:46:23 moby signal-desktop[4097]: [4097:1203/134623.906367:ERROR:ozone_platform_x11.cc(240)] Missing X server or $DISPLAY
|
|
|
|
# Dec 03 13:46:23 moby signal-desktop[4097]: [4097:1203/134623.909667:ERROR:env.cc(255)] The platform failed to initialize. Exiting.
|
2023-11-17 04:05:59 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.sane.programs.signal-desktop;
|
|
|
|
in
|
2023-11-15 23:07:03 +00:00
|
|
|
{
|
|
|
|
sane.programs.signal-desktop = {
|
2023-11-17 04:05:59 +00:00
|
|
|
configOption = with lib; mkOption {
|
|
|
|
default = {};
|
|
|
|
type = types.submodule {
|
|
|
|
options.autostart = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-20 11:11:12 +00:00
|
|
|
packageUnwrapped = pkgs.signal-desktop-from-src;
|
2024-01-23 16:42:48 +00:00
|
|
|
sandbox.method = "bwrap";
|
2024-01-29 13:45:57 +00:00
|
|
|
sandbox.wrapperType = "wrappedDerivation";
|
2024-02-08 21:51:32 +00:00
|
|
|
sandbox.net = "clearnet";
|
2024-02-13 11:14:38 +00:00
|
|
|
sandbox.whitelistAudio = true;
|
2024-02-14 01:49:49 +00:00
|
|
|
sandbox.whitelistWayland = true;
|
2024-02-15 00:49:24 +00:00
|
|
|
sandbox.extraHomePaths = [
|
|
|
|
"Music"
|
|
|
|
"Pictures"
|
|
|
|
"Pictures/servo-macros"
|
|
|
|
"Videos"
|
|
|
|
"Videos/servo"
|
|
|
|
"tmp"
|
|
|
|
];
|
2023-11-17 04:05:59 +00:00
|
|
|
|
2023-11-15 23:07:03 +00:00
|
|
|
# creds, media
|
|
|
|
persist.byStore.private = [
|
|
|
|
".config/Signal"
|
|
|
|
];
|
2023-11-17 04:05:59 +00:00
|
|
|
|
|
|
|
services.signal-desktop = {
|
2024-02-19 12:57:44 +00:00
|
|
|
description = "signal-desktop Signal Messenger client";
|
|
|
|
after = [ "graphical-session.target" ];
|
|
|
|
# partOf = [ "graphical-session.target" ];
|
2024-02-02 14:21:57 +00:00
|
|
|
wantedBy = lib.mkIf cfg.config.autostart [ "graphical-session.target" ];
|
2024-02-19 12:57:44 +00:00
|
|
|
|
2023-11-17 04:05:59 +00:00
|
|
|
serviceConfig = {
|
|
|
|
ExecStart = "${cfg.package}/bin/signal-desktop";
|
|
|
|
Type = "simple";
|
|
|
|
Restart = "always";
|
|
|
|
RestartSec = "20s";
|
|
|
|
};
|
2023-12-03 12:59:15 +00:00
|
|
|
# for some reason the --ozone-platform-hint=auto flag fails when signal-desktop is launched from a service
|
|
|
|
environment.NIXOS_OZONE_WL = "1";
|
2023-11-17 04:05:59 +00:00
|
|
|
};
|
2023-11-15 23:07:03 +00:00
|
|
|
};
|
|
|
|
}
|