mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-14 02:20:53 -06:00
test: setting up nas structure
This commit is contained in:
parent
8cd193ec49
commit
4225970826
747 changed files with 2938 additions and 4347 deletions
118
modules/nixos/homelab/guests/syncthing/default.nix
Executable file
118
modules/nixos/homelab/guests/syncthing/default.nix
Executable file
|
|
@ -0,0 +1,118 @@
|
|||
{
|
||||
flake,
|
||||
labHelpers,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (import ./config { inherit flake; }) syncthingVM;
|
||||
inherit (flake.config.services) instances;
|
||||
inherit (flake.config.people) user0;
|
||||
serviceCfg = instances.syncthing;
|
||||
interface0Cfg = serviceCfg.interfaces.interface0;
|
||||
|
||||
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 = "";
|
||||
tag = "${serviceCfg.name}_${user}_docs";
|
||||
}
|
||||
{
|
||||
mountPoint = "/var/lib/${serviceCfg.name}/media";
|
||||
proto = "virtiofs";
|
||||
source = "";
|
||||
tag = "${serviceCfg.name}_${user}_media";
|
||||
}
|
||||
{
|
||||
mountPoint = "/var/lib/${serviceCfg.name}/misc";
|
||||
proto = "virtiofs";
|
||||
source = "";
|
||||
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 = interface0Cfg.microvm.ip;
|
||||
mac = interface0Cfg.microvm.mac;
|
||||
userMac = interface0Cfg.microvm.macUser;
|
||||
ssh = interface0Cfg.microvm.ssh;
|
||||
mnt = "";
|
||||
host = interface0Cfg.domain;
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue