1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-11 07:10:39 +02:00

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"; 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 = { services.samba = {
enable = true; enable = true;
openFirewall = true; openFirewall = true;
@ -34,7 +52,7 @@ in {
# Deny access to all hosts by default. # Deny access to all hosts by default.
"hosts deny = 0.0.0.0/0" "hosts deny = 0.0.0.0/0"
# Allow access to local network and TODO: wireguard # 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 # Set sane logging options
"log level = 0 auth:2 passdb:2" "log level = 0 auth:2 passdb:2"
@ -78,11 +96,11 @@ in {
inherit path; inherit path;
public = "no"; public = "no";
writable = "yes"; writable = "yes";
"create mask" = "0770"; "create mask" = "0740";
"directory mask" = "0770"; "directory mask" = "0750";
# "force create mode" = "0660"; # "force create mode" = "0660";
# "force directory mode" = "0770"; # "force directory mode" = "0770";
#"acl allow execute always" = "yes"; "acl allow execute always" = "yes";
} }
// cfg; // cfg;