1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-03-29 03:04:34 +00:00
home-manager/modules/services/megasync.nix

46 lines
1.1 KiB
Nix
Raw Normal View History

2022-12-06 17:21:08 +01:00
{ config, lib, pkgs, ... }:
2025-03-14 13:17:43 +08:00
let cfg = config.services.megasync;
2022-12-06 17:21:08 +01:00
in {
2025-03-14 13:17:43 +08:00
meta.maintainers = [ lib.maintainers.GaetanLepage ];
2022-12-06 17:21:08 +01:00
options = {
services.megasync = {
2025-03-14 13:17:43 +08:00
enable = lib.mkEnableOption "Megasync client";
2022-12-06 17:21:08 +01:00
2025-03-14 13:17:43 +08:00
package = lib.mkPackageOption pkgs "megasync" { };
2025-03-14 13:19:29 +08:00
forceWayland = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = "Force Megasync to run on wayland";
};
2022-12-06 17:21:08 +01:00
};
};
2025-03-14 13:17:43 +08:00
config = lib.mkIf cfg.enable {
2022-12-06 17:21:08 +01:00
assertions = [
(lib.hm.assertions.assertPlatform "services.megasync" pkgs
lib.platforms.linux)
];
home.packages = [ cfg.package ];
systemd.user.services.megasync = {
Unit = {
Description = "megasync";
After = [ "graphical-session.target" ];
2022-12-06 17:21:08 +01:00
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "graphical-session.target" ]; };
2025-03-14 13:19:29 +08:00
Service = {
Environment =
lib.optionals cfg.forceWayland [ "DO_NOT_UNSET_XDG_SESSION_TYPE=1" ];
ExecStart = lib.getExe' cfg.package "megasync";
};
2022-12-06 17:21:08 +01:00
};
};
}