This commit is contained in:
Chris Kruining 2025-04-01 19:58:31 +02:00
parent 941801e94f
commit c6933ae16a
Signed by: chris
SSH key fingerprint: SHA256:nG82MUfuVdRVyCKKWqhY+pCrbz9nbX6uzUns4RKa1Pg
7 changed files with 150 additions and 78 deletions

View file

@ -1,22 +1,24 @@
{ config, options, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkIf;
user = "nextcloud";
in
{
options.modules.services.nextcloud = let
inherit (lib.options) mkEnableOption;
in {
options.modules.services.nextcloud = {
enable = mkEnableOption "Nextcloud";
};
config = mkIf config.modules.services.nextcloud.enable {
users.users.${user} = {
name = user;
isSystemUser = true;
home = "/home/${user}";
group = user;
users = {
users.${user} = {
name = user;
isSystemUser = true;
home = "/home/${user}";
group = user;
};
groups.${user} = {};
};
home-manager.users.${user}.home.file.".netrc".text = ''
@ -30,6 +32,7 @@ in
Description = "Automatic nextcloud sync";
After = "network-online.target";
};
WantedBy = [ "multi-user.target" ];
Service = {
Type = "simple";
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /var/music /home/${user}/Music https://cloud.kruining.eu";
@ -37,8 +40,8 @@ in
KillMode = "process";
KillSignal = "SIGINT";
};
Install.WantedBy = [ "multi-user.target" ];
};
timers.nextcloud-autosync = {
Unit.Description = "Automatic nextcloud sync";
Timer.OnBootSec = "5min";