test: setting up nas structure

This commit is contained in:
Nick 2025-12-08 22:25:13 -06:00
parent 8cd193ec49
commit 4225970826
747 changed files with 2938 additions and 4347 deletions

View file

@ -1,123 +0,0 @@
{ flake, nasHelpers, ... }:
let
inherit (import ./config { inherit flake; }) syncthingVM;
inherit (flake.config.services) instances;
inherit (flake.config.people) user0;
inherit (nasHelpers)
ipAddress
guestPath
docsPath
mediaPath
miscPath
syncthing
;
serviceCfg = instances.syncthing;
id0 = builtins.toString syncthing.id0;
id1 = builtins.toString syncthing.id1;
id2 = builtins.toString syncthing.id2;
foldersHelper = user: {
docs = {
enable = true;
id = "docs";
path = "/var/lib/${serviceCfg.name}/docs";
devices = [
"${user}Phone"
];
};
media = {
enable = true;
id = "media";
path = "/var/lib/${serviceCfg.name}/media";
devices = [
"${user}Phone"
];
};
misc = {
enable = true;
id = "misc";
path = "/var/lib/${serviceCfg.name}/misc";
devices = [
"${user}Phone"
];
};
};
devicesHelper = user: syncID: device: deviceIP: {
"${user}${device}" = {
autoAcceptFolders = true;
name = "${user}${device}";
addresses = [
"tcp://${deviceIP}:${toString serviceCfg.ports.port2}"
];
id = syncID;
};
};
mountsHelper = user: [
{
mountPoint = "/var/lib/${serviceCfg.name}/docs";
proto = "virtiofs";
source = docsPath user;
tag = "${serviceCfg.name}_${user}_docs";
}
{
mountPoint = "/var/lib/${serviceCfg.name}/media";
proto = "virtiofs";
source = mediaPath user;
tag = "${serviceCfg.name}_${user}_media";
}
{
mountPoint = "/var/lib/${serviceCfg.name}/misc";
proto = "virtiofs";
source = miscPath user;
tag = "${serviceCfg.name}_${user}_misc";
}
];
tmpRules = [
"d /var/lib/${serviceCfg.name}/docs 0755 ${serviceCfg.name} ${serviceCfg.name} -"
"d /var/lib/${serviceCfg.name}/media 0755 ${serviceCfg.name} ${serviceCfg.name} -"
"d /var/lib/${serviceCfg.name}/misc 0755 ${serviceCfg.name} ${serviceCfg.name} -"
];
syncthingNick =
let
phoneID = "OALKHLZ-OODUWVX-PAC2LI7-UMZMSZO-FELLRCD-RS4DHJS-PVA5YQK-WTFXXQI";
in
syncthingVM {
user = user0;
ip = ipAddress id0;
mac = "02:00:00:00:${id0}:${id0}";
userMac = "02:00:00:00:00:${id0}";
ssh = syncthing.ssh0;
mnt = guestPath user0;
folders = foldersHelper user0;
devices = devicesHelper user0 phoneID "Phone" "192.168.50.8";
tmp = tmpRules;
mounts = mountsHelper user0;
};
# syncthingStacie = syncthingVM {
# user = "stacie";
# ip = ipAddress id0;
# mac = "02:00:00:00:${id0}:${id0}";
# userMac = "02:00:00:00:00:${id0}";
# ssh = syncthing.ssh0;
# syncID = "";
# deviceIP = "";
# };
# syncthingGarnet = syncthingVM {
# user = "garnet";
# ip = ipAddress id0;
# mac = "02:00:00:00:${id0}:${id0}";
# userMac = "02:00:00:00:00:${id0}";
# ssh = syncthing.ssh0;
# syncID = "";
# deviceIP = "";
# };
in
syncthingNick
# // syncthingStacie // syncthingGarnet