feat: add persistent directories for samba storage

This commit is contained in:
oddlama 2024-01-06 17:00:48 +01:00
parent 140b0d06e1
commit eb67e58208
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
2 changed files with 22 additions and 4 deletions

View file

@ -11,6 +11,24 @@ in {
mode = "600";
};
fileSystems."/storage".neededForBoot = true;
environment.persistence."/storage" = {
hideMounts = true;
directories =
lib.flip lib.mapAttrsToList smbUsers (name: _: {
directory = "/shares/users/${name}";
user = name;
group = name;
mode = "0750";
})
++ lib.flip lib.mapAttrsToList smbGroups (name: _: {
directory = "/shares/groups/${name}";
user = name;
group = name;
mode = "0750";
});
};
services.samba = {
enable = true;
openFirewall = true;
@ -34,7 +52,7 @@ in {
# Deny access to all hosts by default.
"hosts deny = 0.0.0.0/0"
# Allow access to local network and TODO: wireguard
"hosts allow = 192.168.1.0/22 192.168.100.0/24"
"hosts allow = 192.168.1.0/24"
# Set sane logging options
"log level = 0 auth:2 passdb:2"
@ -78,11 +96,11 @@ in {
inherit path;
public = "no";
writable = "yes";
"create mask" = "0770";
"directory mask" = "0770";
"create mask" = "0740";
"directory mask" = "0750";
# "force create mode" = "0660";
# "force directory mode" = "0770";
#"acl allow execute always" = "yes";
"acl allow execute always" = "yes";
}
// cfg;