1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/modules/services/kdeconnect.nix
Austin Horstman 86402a17b6 treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce
conflicts with other PRs.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-06-23 16:20:26 -05:00

90 lines
2.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.kdeconnect;
in
{
meta.maintainers = [ lib.maintainers.adisbladis ];
options = {
services.kdeconnect = {
enable = lib.mkEnableOption "KDE connect";
package = lib.mkPackageOption pkgs.kdePackages "kdeconnect-kde" {
example = "pkgs.plasma5Packages.kdeconnect-kde";
pkgsText = "pkgs.kdePackages";
};
indicator = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether to enable kdeconnect-indicator service.";
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
home.packages = [ cfg.package ];
assertions = [
(lib.hm.assertions.assertPlatform "services.kdeconnect" pkgs lib.platforms.linux)
];
systemd.user.services.kdeconnect = {
Unit = {
Description = "Adds communication between your desktop and your smartphone";
After = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart =
if lib.strings.versionAtLeast (lib.versions.majorMinor cfg.package.version) "24.05" then
"${cfg.package}/bin/kdeconnectd"
else
"${cfg.package}/libexec/kdeconnectd";
Restart = "on-abort";
};
};
})
(lib.mkIf cfg.indicator {
assertions = [
(lib.hm.assertions.assertPlatform "services.kdeconnect" pkgs lib.platforms.linux)
];
systemd.user.services.kdeconnect-indicator = {
Unit = {
Description = "kdeconnect-indicator";
After = [
"graphical-session.target"
"tray.target"
];
PartOf = [ "graphical-session.target" ];
Requires = [ "tray.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Environment = [ "PATH=${config.home.profileDirectory}/bin" ];
ExecStart = "${cfg.package}/bin/kdeconnect-indicator";
Restart = "on-abort";
};
};
})
];
}