2018-06-04 13:59:38 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.kdeconnect;
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
in {
|
2018-06-04 13:59:38 +00:00
|
|
|
meta.maintainers = [ maintainers.adisbladis ];
|
|
|
|
|
|
|
|
options = {
|
|
|
|
services.kdeconnect = {
|
|
|
|
enable = mkEnableOption "KDE connect";
|
2024-04-04 21:08:04 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.plasma5Packages.kdeconnect-kde;
|
|
|
|
example = literalExpression "pkgs.kdePackages.kdeconnect-kde";
|
|
|
|
description = "The KDE connect package to use";
|
|
|
|
};
|
2018-06-04 13:59:38 +00:00
|
|
|
|
|
|
|
indicator = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = "Whether to enable kdeconnect-indicator service.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf cfg.enable {
|
2024-04-04 21:08:04 +00:00
|
|
|
home.packages = [ cfg.package ];
|
2018-06-04 13:59:38 +00:00
|
|
|
|
2022-04-24 14:25:54 +00:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "services.kdeconnect" pkgs
|
|
|
|
platforms.linux)
|
|
|
|
];
|
|
|
|
|
2018-06-04 13:59:38 +00:00
|
|
|
systemd.user.services.kdeconnect = {
|
|
|
|
Unit = {
|
2020-02-01 23:39:17 +00:00
|
|
|
Description =
|
|
|
|
"Adds communication between your desktop and your smartphone";
|
2018-06-04 13:59:38 +00:00
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
2024-04-19 21:41:23 +00:00
|
|
|
};
|
2018-06-04 13:59:38 +00:00
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
2018-06-04 13:59:38 +00:00
|
|
|
|
|
|
|
Service = {
|
2018-07-29 16:15:50 +00:00
|
|
|
Environment = "PATH=${config.home.profileDirectory}/bin";
|
2024-05-30 07:05:10 +00:00
|
|
|
ExecStart =
|
|
|
|
if strings.versionAtLeast (versions.majorMinor cfg.package.version)
|
|
|
|
"24.05" then
|
|
|
|
"${cfg.package}/bin/kdeconnectd"
|
|
|
|
else
|
|
|
|
"${cfg.package}/libexec/kdeconnectd";
|
2018-06-04 13:59:38 +00:00
|
|
|
Restart = "on-abort";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf cfg.indicator {
|
2022-04-24 14:25:54 +00:00
|
|
|
assertions = [
|
|
|
|
(hm.assertions.assertPlatform "services.kdeconnect" pkgs
|
|
|
|
platforms.linux)
|
|
|
|
];
|
|
|
|
|
2018-06-04 13:59:38 +00:00
|
|
|
systemd.user.services.kdeconnect-indicator = {
|
|
|
|
Unit = {
|
|
|
|
Description = "kdeconnect-indicator";
|
2020-02-01 23:39:17 +00:00
|
|
|
After = [
|
|
|
|
"graphical-session-pre.target"
|
|
|
|
"polybar.service"
|
|
|
|
"taffybar.service"
|
|
|
|
"stalonetray.service"
|
|
|
|
];
|
2018-06-04 13:59:38 +00:00
|
|
|
PartOf = [ "graphical-session.target" ];
|
2024-04-19 21:41:23 +00:00
|
|
|
Requires = [ "tray.target" ];
|
2018-06-04 13:59:38 +00:00
|
|
|
};
|
|
|
|
|
2020-02-01 23:39:17 +00:00
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
2018-06-04 13:59:38 +00:00
|
|
|
|
|
|
|
Service = {
|
2018-07-29 16:15:50 +00:00
|
|
|
Environment = "PATH=${config.home.profileDirectory}/bin";
|
2024-04-04 21:08:04 +00:00
|
|
|
ExecStart = "${cfg.package}/bin/kdeconnect-indicator";
|
2018-06-04 13:59:38 +00:00
|
|
|
Restart = "on-abort";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|