test: setting up nas structure

This commit is contained in:
Nick 2025-12-07 04:37:17 -06:00
parent 7cf2f70441
commit 312c52d613
8 changed files with 100 additions and 73 deletions

View file

@ -83,7 +83,7 @@ in
impermanence impermanence
lix lix
microvm microvm
opencloud0 nas
sambaEris sambaEris
; ;
}; };

View file

@ -0,0 +1,18 @@
{
flake,
pkgs,
lib,
...
}:
let
syncthing = import ./syncthing { inherit flake; };
photoprism = import ./photoprism { inherit flake lib; };
opencloud = import ./opencloud { inherit flake pkgs; };
in
{
imports = [
syncthing
photoprism
opencloud
];
}

View file

@ -91,7 +91,7 @@ in
network = { network = {
enable = true; enable = true;
networks."20-lan" = { networks."20-lan" = {
matchConfig.Name = "enp0s6"; matchConfig.Name = "enp0s5";
addresses = [ addresses = [
{ Address = "${ip}/24"; } { Address = "${ip}/24"; }
]; ];
@ -110,7 +110,6 @@ in
tmpfiles.rules = [ tmpfiles.rules = [
"d /var/lib/${serviceCfg.name} 0755 ${serviceCfg.name} ${serviceCfg.name} -" "d /var/lib/${serviceCfg.name} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
"z /etc/opencloud 0700 ${serviceCfg.name} ${serviceCfg.name} -" "z /etc/opencloud 0700 ${serviceCfg.name} ${serviceCfg.name} -"
]; ];
}; };
microvm = { microvm = {

View file

@ -1,6 +1,6 @@
{ flake, ... }: { flake, pkgs, ... }:
let let
inherit (import ./config) opencloudVM; inherit (import ./config { inherit flake pkgs; }) opencloudVM;
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
opencloudNick = opencloudVM { opencloudNick = opencloudVM {
@ -12,23 +12,24 @@ let
host = ""; host = "";
}; };
opencloudStacie = opencloudVM { # opencloudStacie = opencloudVM {
user = "stacie"; # user = "stacie";
ip = "192.168.50.68"; # ip = "192.168.50.68";
mac = "02:00:00:00:58:68"; # mac = "02:00:00:00:58:68";
userMac = "02:00:00:00:00:68"; # userMac = "02:00:00:00:00:68";
ssh = 2508; # ssh = 2508;
host = ""; # host = "";
}; # };
opencloudGarnet = opencloudVM { # opencloudGarnet = opencloudVM {
user = "garnet"; # user = "garnet";
ip = "192.168.50.69"; # ip = "192.168.50.69";
mac = "02:00:00:00:59:69"; # mac = "02:00:00:00:59:69";
userMac = "02:00:00:00:00:69"; # userMac = "02:00:00:00:00:69";
ssh = 2509; # ssh = 2509;
host = ""; # host = "";
}; # };
in in
opencloudNick // opencloudStacie // opencloudGarnet opencloudNick
# // opencloudStacie // opencloudGarnet

View file

@ -1,6 +1,6 @@
{ {
config,
flake, flake,
lib,
... ...
}: }:
let let
@ -35,8 +35,10 @@ in
PHOTOPRISM_DEFAULT_LOCAL = "en"; PHOTOPRISM_DEFAULT_LOCAL = "en";
}; };
passwordFile = "/run/secrets/${user}-pass"; passwordFile = "/run/secrets/${user}-pass";
storagePath = "/var/lib/${serviceCfg.name}";
originalsPath = "/var/lib/${serviceCfg.name}-media"; originalsPath = "/var/lib/${serviceCfg.name}-media";
importPath = "photos"; importPath = "photos";
address = "0.0.0.0";
}; };
openssh = { openssh = {
enable = true; enable = true;
@ -47,6 +49,13 @@ in
}; };
}; };
users.users.photoprism = {
isSystemUser = true;
group = "photoprism";
home = "/var/lib/photoprism";
};
users.groups.photoprism = { };
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
22 22
2342 2342
@ -54,6 +63,13 @@ in
systemd = { systemd = {
services = { services = {
photoprism = {
serviceConfig = {
DynamicUser = lib.mkForce false;
User = serviceCfg.name;
Group = serviceCfg.name;
};
};
systemd-networkd.wantedBy = [ systemd-networkd.wantedBy = [
"multi-user.target" "multi-user.target"
]; ];
@ -78,12 +94,11 @@ in
}; };
}; };
tmpfiles.rules = [ # tmpfiles.rules = [
"Z /var/lib/${serviceCfg.name} 0755 ${serviceCfg.name} ${serviceCfg.name} -" # "d /var/lib/${serviceCfg.name} 0755 ${serviceCfg.name} ${serviceCfg.name} -"
"d /var/lib/${serviceCfg.name}-media 0755 ${serviceCfg.name} ${serviceCfg.name} -" # "d /var/lib/${serviceCfg.name}-media 0755 ${serviceCfg.name} ${serviceCfg.name} -"
"d /var/lib/${serviceCfg.name}-media/photos 0755 ${serviceCfg.name} ${serviceCfg.name} -" # "d /var/lib/${serviceCfg.name}-media/photos 0755 ${serviceCfg.name} ${serviceCfg.name} -"
# ];
];
}; };
microvm = { microvm = {

View file

@ -1,6 +1,6 @@
{ flake, ... }: { flake, lib, ... }:
let let
inherit (import ./config) photoprismVM; inherit (import ./config { inherit flake lib; }) photoprismVM;
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
photoprismNick = photoprismVM { photoprismNick = photoprismVM {
@ -11,21 +11,22 @@ let
ssh = 2504; ssh = 2504;
}; };
photoprismStacie = photoprismVM { # photoprismStacie = photoprismVM {
user = "stacie"; # user = "stacie";
ip = "192.168.50.65"; # ip = "192.168.50.65";
mac = "02:00:00:00:55:65"; # mac = "02:00:00:00:55:65";
userMac = "02:00:00:00:00:65"; # userMac = "02:00:00:00:00:65";
ssh = 2505; # ssh = 2505;
}; # };
photoprismGarnet = photoprismVM { # photoprismGarnet = photoprismVM {
user = "garnet"; # user = "garnet";
ip = "192.168.50.66"; # ip = "192.168.50.66";
mac = "02:00:00:00:56:66"; # mac = "02:00:00:00:56:66";
userMac = "02:00:00:00:00:66"; # userMac = "02:00:00:00:00:66";
ssh = 2506; # ssh = 2506;
}; # };
in in
photoprismNick // photoprismStacie // photoprismGarnet photoprismNick
# // photoprismStacie // photoprismGarnet

View file

@ -195,12 +195,5 @@ in
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d /mnt/storage/users/${user}/guests/${serviceCfg.name} 0751 microvm wheel - -" "d /mnt/storage/users/${user}/guests/${serviceCfg.name} 0751 microvm wheel - -"
]; ];
sops.secrets = {
"${serviceCfg.name}/${user}-pass" = {
owner = "root";
mode = "0600";
};
};
}; };
} }

View file

@ -1,6 +1,6 @@
{ flake, ... }: { flake, ... }:
let let
inherit (import ./config) syncthingVM; inherit (import ./config { inherit flake; }) syncthingVM;
inherit (flake.config.people) user0; inherit (flake.config.people) user0;
syncthingNick = syncthingVM { syncthingNick = syncthingVM {
@ -9,29 +9,29 @@ let
mac = "02:00:00:00:51:61"; mac = "02:00:00:00:51:61";
userMac = "02:00:00:00:00:61"; userMac = "02:00:00:00:00:61";
ssh = 2501; ssh = 2501;
syncID = "RMDKNJY-BTX6FYF-G6SR332-WS6HARI-PF74SC6-VPBSGRQ-MKVQZEQ-KSIB6QV"; syncID = "OALKHLZ-OODUWVX-PAC2LI7-UMZMSZO-FELLRCD-RS4DHJS-PVA5YQK-WTFXXQI";
deviceIP = "192.168.50.8"; deviceIP = "192.168.50.8";
}; };
syncthingStacie = syncthingVM { # syncthingStacie = syncthingVM {
user = "stacie"; # user = "stacie";
ip = "192.168.50.62"; # ip = "192.168.50.62";
mac = "02:00:00:00:52:62"; # mac = "02:00:00:00:52:62";
userMac = "02:00:00:00:00:62"; # userMac = "02:00:00:00:00:62";
ssh = 2502; # ssh = 2502;
syncID = ""; # syncID = "";
deviceIP = ""; # deviceIP = "";
}; # };
syncthingGarnet = syncthingVM { # syncthingGarnet = syncthingVM {
user = "garnet"; # user = "garnet";
ip = "192.168.50.63"; # ip = "192.168.50.63";
mac = "02:00:00:00:53:63"; # mac = "02:00:00:00:53:63";
userMac = "02:00:00:00:00:63"; # userMac = "02:00:00:00:00:63";
ssh = 2503; # ssh = 2503;
syncID = ""; # syncID = "";
deviceIP = ""; # deviceIP = "";
}; # };
in in
syncthingNick syncthingNick