Added diwan to thingvellir
This commit is contained in:
1 parent
b369ef8e1d
commit
f5ffea6d64
7 files changed
+107
-13
No files matched your search
@@ -43,6 +43,9 @@ in
|
||||
description = "diwan tick";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
# diwan shells out to `herdr`; systemd's default service PATH doesn't
|
||||
# include it, so add it explicitly rather than relying on the login PATH.
|
||||
path = [ inputs.herdr.packages.${system}.default ];
|
||||
environment = {
|
||||
DIWAN_NOTES_DIR = cfg.notesDir;
|
||||
};
|
||||
|
||||
@@ -6,16 +6,75 @@ in
|
||||
{
|
||||
options.samfelag.modules.app.nextcloud = {
|
||||
enable = lib.mkEnableOption "nextcloud";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
nextcloud-client
|
||||
];
|
||||
|
||||
hm.services.nextcloud-client = {
|
||||
enable = true;
|
||||
startInBackground = true;
|
||||
syncClient = {
|
||||
enable = lib.mkEnableOption "headless nextcloud sync via nextcloudcmd on a timer";
|
||||
|
||||
user = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "User to run the sync as, and Nextcloud login name";
|
||||
};
|
||||
|
||||
localDir = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Local directory to sync";
|
||||
};
|
||||
|
||||
remoteUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Nextcloud server URL";
|
||||
};
|
||||
|
||||
remotePath = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Remote path on the Nextcloud server to sync";
|
||||
};
|
||||
|
||||
passwordFile = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Path to an EnvironmentFile containing NC_PASSWORD=... (should be secret)";
|
||||
};
|
||||
|
||||
interval = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "1min";
|
||||
description = "How often to run the sync (systemd time span)";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
nextcloud-client
|
||||
];
|
||||
|
||||
hm.services.nextcloud-client = {
|
||||
enable = true;
|
||||
startInBackground = true;
|
||||
};
|
||||
})
|
||||
|
||||
(lib.mkIf cfg.syncClient.enable {
|
||||
systemd.services.nextcloud-sync = {
|
||||
description = "Nextcloud headless sync (nextcloudcmd)";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.syncClient.user;
|
||||
EnvironmentFile = cfg.syncClient.passwordFile;
|
||||
ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd --non-interactive -u ${cfg.syncClient.user} --path ${cfg.syncClient.remotePath} ${cfg.syncClient.localDir} ${cfg.syncClient.remoteUrl}";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.nextcloud-sync = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = cfg.syncClient.interval;
|
||||
OnUnitActiveSec = cfg.syncClient.interval;
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user