From 5e9482611e19fbe5d956fbe09460271688089c70 Mon Sep 17 00:00:00 2001 From: Ahwx Date: Mon, 15 Dec 2025 18:30:32 +0100 Subject: [PATCH] feat: adds nextcloud auto syncing --- modules/home/default.nix | 1 + modules/home/nextcloud.nix | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 modules/home/nextcloud.nix diff --git a/modules/home/default.nix b/modules/home/default.nix index 8abd449..aaec9da 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -10,6 +10,7 @@ ++ [ (import ./kitty.nix) ] ++ [ (import ./kanshi.nix) ] ++ [ (import ./foot.nix) ] + ++ [ (import ./nextcloud.nix) ] ++ [ (import ./nvim.nix) ] ++ [ (import ./zathura.nix) ] ++ [ (import ./packages.nix) ] diff --git a/modules/home/nextcloud.nix b/modules/home/nextcloud.nix new file mode 100644 index 0000000..7e4d10f --- /dev/null +++ b/modules/home/nextcloud.nix @@ -0,0 +1,40 @@ +{ + pkgs, + config, + username, + ... +}: +let + nexturl = "cloud.liv.town"; +in +{ + home.packages = with pkgs; [ + nextcloud-client + ]; + systemd.user = { + services.nextcloud-autosync = { + Unit = { + Description = "Auto sync Nextcloud"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /music /home/${username}/cloud/music https://${nexturl}"; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = [ "multi-user.target" ]; + }; + timers.nextcloud-autosync = { + Unit.Description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 60 minutes"; + Timer.OnBootSec = "5min"; + Timer.OnUnitActiveSec = "30min"; + Install.WantedBy = [ + "multi-user.target" + "timers.target" + ]; + }; + startServices = true; + }; +}