From 9b6d18d9c111417b3489ceb4c87b4073b964fdb4 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Sun, 4 Jun 2023 14:21:37 +0200 Subject: [PATCH] Switch to maestral as dropbox client --- home-manager/modules/dropbox/default.nix | 28 +++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/home-manager/modules/dropbox/default.nix b/home-manager/modules/dropbox/default.nix index c68b32d..2d2ec1e 100644 --- a/home-manager/modules/dropbox/default.nix +++ b/home-manager/modules/dropbox/default.nix @@ -1,4 +1,5 @@ -{ lib +{ pkgs +, lib , config , ... }: @@ -6,9 +7,30 @@ with lib; let cfg = config.eboskma.programs.dropbox; in { - options.eboskma.programs.dropbox = { enable = mkEnableOption "activate dropbox"; }; + options.eboskma.programs.dropbox = { enable = mkEnableOption "dropbox using the maestral client"; }; config = mkIf cfg.enable { - services.dropbox.enable = true; + systemd.user.services = { + maestral = { + Unit = { + Description = "Maestral daemon"; + }; + + Service = { + Type = "notify"; + NotifyAccess = "exec"; + ExecStart = "${pkgs.maestral}/bin/maestral start -f"; + ExecStop = "${pkgs.maestral}/bin/maestral stop"; + ExecStopPost = ''${pkgs.bash}/bin/bash -c "if [[ $SERVICE_RESULT != success ]]; then notify-send Maestral 'Daemon failed'; fi"''; + WatchdogSec = "30s"; + }; + + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; + + home.packages = [ pkgs.maestral-gui pkgs.maestral ]; }; }