2023-05-01 14:11:51 +02:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.my.services.synology-drive;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.synology-drive = {
|
|
|
|
enable = mkEnableOption "synology-drive";
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.synology-drive-client;
|
|
|
|
description = "The package to use for synology-drive";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.synology-drive = {
|
2023-05-01 14:19:37 +02:00
|
|
|
after = [ "graphical-session.target" "network.target" ];
|
2023-05-01 14:11:51 +02:00
|
|
|
partOf = [ "graphical-session.target" ];
|
|
|
|
wantedBy = [ "graphical-session.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
ExitType = "cgroup";
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "1s";
|
|
|
|
ExecStartPre = "${pkgs.coreutils}/bin/rm -rf %h/.SynologyDrive/SynologyDrive.app %h/.SynologyDrive/cloud-connect.pid";
|
|
|
|
ExecStart = "${cfg.package}/bin/synology-drive";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
};
|
|
|
|
}
|