mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(moodle-dl): sync via syncthing instead of sshfs
This commit is contained in:
@@ -28,14 +28,7 @@
|
|||||||
declarative = rec {
|
declarative = rec {
|
||||||
cert = toString <system-secrets/syncthing/cert.pem>;
|
cert = toString <system-secrets/syncthing/cert.pem>;
|
||||||
key = toString <system-secrets/syncthing/key.pem>;
|
key = toString <system-secrets/syncthing/key.pem>;
|
||||||
devices = {
|
inherit ((import <niveum/lib>).syncthing) devices;
|
||||||
wilde.id =
|
|
||||||
"R6DEBD7-G5RYDKN-VFA3HPO-WX4DNVI-373F7OQ-AW5MZTT-3L4BDVW-Y6ROEAF";
|
|
||||||
heym.id =
|
|
||||||
"HLQSG3D-WSKLA6S-MEYQ3EU-GDBGABE-PY53RQ6-SWQAP2I-Z5MVBVX-MYPJXAM";
|
|
||||||
manakish.id =
|
|
||||||
"AJVBWR2-VFFAGZF-7ZF5JAX-T63GMOG-NZ446WK-MC5E6WK-6X6Q2HE-QQA2JQ3";
|
|
||||||
};
|
|
||||||
folders =
|
folders =
|
||||||
let syncthing-dir = "${config.users.users.me.home}/cloud/syncthing";
|
let syncthing-dir = "${config.users.users.me.home}/cloud/syncthing";
|
||||||
in {
|
in {
|
||||||
|
|||||||
@@ -29,34 +29,6 @@ in {
|
|||||||
eduroam.auth = eduroamAuth;
|
eduroam.auth = eduroamAuth;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/mnt/moodle" = {
|
|
||||||
device = "moodle@toum.r:/var/lib/moodle";
|
|
||||||
fsType = "fuse.sshfs";
|
|
||||||
options = [
|
|
||||||
"IdentityFile=/root/.ssh/id_rsa"
|
|
||||||
"Port=${toString sshPort}"
|
|
||||||
"_netdev"
|
|
||||||
"allow_other"
|
|
||||||
"default_permissions"
|
|
||||||
"gid=100"
|
|
||||||
"idmap=user"
|
|
||||||
# "noatime"
|
|
||||||
"noauto"
|
|
||||||
# "nodiratime"
|
|
||||||
"x-systemd.nofail"
|
|
||||||
"reconnect"
|
|
||||||
"ro"
|
|
||||||
"uid=1000"
|
|
||||||
"x-systemd.automount"
|
|
||||||
"x-systemd.device-timeout=1s"
|
|
||||||
"x-systemd.idle-timeout=1min"
|
|
||||||
"x-systemd.mount-timeout=1s"
|
|
||||||
"x-systemd.requires=tinc.retiolum.service"
|
|
||||||
"x-systemd.requires=wpa_supplicant.service"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
pkgs.sshfsFuse
|
pkgs.sshfsFuse
|
||||||
|
|
||||||
|
|||||||
@@ -35,11 +35,13 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
moodle-dl-json = pkgs.writeText "moodle-dl.json" (builtins.toJSON moodle-dl-config);
|
moodle-dl-json = pkgs.writeText "moodle-dl.json" (builtins.toJSON moodle-dl-config);
|
||||||
|
|
||||||
|
moodle-dl-directory = "/var/lib/moodle";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.extraUsers.moodle = {
|
users.extraUsers.moodle = {
|
||||||
isNormalUser = false;
|
isNormalUser = false;
|
||||||
home = "/var/lib/moodle";
|
home = moodle-dl-directory;
|
||||||
createHome = true;
|
createHome = true;
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
# for sshfs mount
|
# for sshfs mount
|
||||||
@@ -51,6 +53,22 @@ in
|
|||||||
|
|
||||||
system.activationScripts.moodle-dl-config = "ln -sfn ${toString moodle-dl-json} ${config.users.extraUsers.moodle.home}/config.json";
|
system.activationScripts.moodle-dl-config = "ln -sfn ${toString moodle-dl-json} ${config.users.extraUsers.moodle.home}/config.json";
|
||||||
|
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = "moodle"; # config.users.extraUsers.moodle.name;
|
||||||
|
openDefaultPorts = true;
|
||||||
|
configDir = "${moodle-dl-directory}/.config/syncthing";
|
||||||
|
dataDir = "${moodle-dl-directory}/.config/syncthing";
|
||||||
|
declarative = rec {
|
||||||
|
cert = toString <system-secrets/syncthing/cert.pem>;
|
||||||
|
key = toString <system-secrets/syncthing/key.pem>;
|
||||||
|
devices = {
|
||||||
|
inherit ((import <niveum/lib>).syncthing.devices) wilde manakish toum;
|
||||||
|
};
|
||||||
|
folders.${moodle-dl-directory}.devices = [ "wilde" "manakish" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services.moodle-dl = {
|
systemd.services.moodle-dl = {
|
||||||
enable = true;
|
enable = true;
|
||||||
startAt = "hourly";
|
startAt = "hourly";
|
||||||
|
|||||||
@@ -37,6 +37,13 @@
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
syncthing.devices = {
|
||||||
|
wilde.id = "R6DEBD7-G5RYDKN-VFA3HPO-WX4DNVI-373F7OQ-AW5MZTT-3L4BDVW-Y6ROEAF";
|
||||||
|
heym.id = "HLQSG3D-WSKLA6S-MEYQ3EU-GDBGABE-PY53RQ6-SWQAP2I-Z5MVBVX-MYPJXAM";
|
||||||
|
manakish.id = "AJVBWR2-VFFAGZF-7ZF5JAX-T63GMOG-NZ446WK-MC5E6WK-6X6Q2HE-QQA2JQ3";
|
||||||
|
toum.id = "CBJQXFF-FMFGWFU-2J6FMPR-SRDTSGX-7NHOYOH-CQCABKF-KQJMRJC-SDE24Q4";
|
||||||
|
};
|
||||||
|
|
||||||
ignorePaths = [
|
ignorePaths = [
|
||||||
"*~"
|
"*~"
|
||||||
".stack-work/"
|
".stack-work/"
|
||||||
|
|||||||
Reference in New Issue
Block a user